PDA

View Full Version : using dt module



sandyrepope
15-08-2007, 00:38
Here is a script showing how to use some of the dt module functions.

uses "ui"
uses "dt"

dim s as string 'holds the current date
dim week_day_name as string
dim day as long
dim day_string as string
dim month as string
dim year as long

s = date$ 'get the current date

week_day_name = dt_getweekdayname(dt_getweekday(S), %dt_use_long_form)

month = dt_getmonthname(s, %dt_use_long_form)

day = dt_day(s)

day_string = day
select case day_string
case "1","21","31"
day_string += "st"
case "2","22"
day_string += "nd"
case "3","23"
day_string += "rd"
case else
day_string += "th"
end select

year = dt_year(s)

msgbox 0, "Today is" _
+ $crlf _
+ week_day_name _
+ $crlf _
+ month + " " _
+ day_string + " " _
+ year


Thanks
Sandy

Michael Hartlef
15-08-2007, 06:16
Thanks for sharing!

kryton9
15-08-2007, 07:07
Thanks Sandy, when I saw DT Module, I had no idea what it was, he he he. So thanks for shining light on the ignored at least by me Module. But when I do database and serious programming nothing like having nice date and time functions!!