PDA

View Full Version : date and time :)



Lionheart008
23-04-2009, 19:07
hi all :)
little thing about date and time functions...
I know how to build a correct message box with date and time ;)

but...

tried this one...


uses "UI", "DT"

msgbox, format$(date$, "dd.mm.yyyy") + date$, "","Test for date "
msgbox, format$(time$, "hh:nn:ss") + time$, "","Test for time "


I was just curious to test it, but doesn't work without "date$"and "time$" commands:


date$, "dd.mm.yyyy"

so I have used the correctly date$, time$ commands ;)

my dummy question: it's possible to program the date and time values easier like this one: ??? "dd.mm.yyyy" as date, time, weekday, seconds and so on... functions ???

ciao, Lionheart
ps: perhaps this is the wrong place for this question... but I post it here... :)

Petr Schreiber
23-04-2009, 19:41
Hi Frank,

as help file says, Format$ serves only for numeric expressions.
Time$ and Date$ return strings.

But good news - DateTime module allows what you need:


uses "Console", "DT"

printl DT_DateFormat(date$, "dd.MM.yyyy")
printl DT_TimeFormat(time$, "hh:mm:ss")

waitkey


Petr

Lionheart008
23-04-2009, 19:58
thanks petr!

haven't read DT properties not at all, I was too lazy ;)

new one:


uses "Console", "DT","UI"

printl DT_DateFormat(date$, "dd.MM.yyyy")
printl DT_TimeFormat(time$, "hh:mm:ss")

printl DT_GetWeekDayName(DT_GetWeekDay("04-23-09"), %DT_USE_SHORT_FORM)
MSGBOX 0, DT_GetWeekDayName(DT_GetWeekDay("04-23-09"), %DT_USE_SHORT_FORM) '---results "Thu"

waitkey

... but how I can fetch the weekday automatically by


DT_GetWeekDay("04-23-09")

without typing in the date ("04-23-09") here by hand to get the weekday ??? ;) I have unread something??? or I am too tired... (sorry..) I will check it again...

ciao Lionheart

Petr Schreiber
23-04-2009, 20:25
Frank,

answer to your question is on line 3 of the script ;)


Petr

Lionheart008
23-04-2009, 21:40
the mouse is in the hole :) was only really too tired... checked it... and runs :D
needed only fresh air...


'--- testscript by lionheart :)

uses "Console", "DT","UI"

printl DT_DateFormat(date$, "dd.MM.yyyy")
printl DT_TimeFormat(time$, "hh:mm:ss")

printl DT_GetWeekDayName(DT_GetWeekDay(date$), %DT_USE_LONG_FORM)

MSGBOX 0, DT_GetWeekDayName(DT_GetWeekDay("04-23-09"), %DT_USE_SHORT_FORM) '---results "Thu"

waitkey

good evening, thanks for little "line 3" advice, petr, ciao, freezing Lionhead

Lionheart008
24-04-2009, 07:08
a little cup of thinbasic coffee with date and time instant powder for the morning :)


'--- date and time example testscript by lionheart :), 23.april.2009

uses "Console", "DT","UI"

printl DT_DateFormat(date$, "dd.MM.yyyy")
printl DT_TimeFormat(time$, "hh:mm:ss")

printl DT_GetWeekDayName(DT_GetWeekDay(date$), %DT_USE_LONG_FORM)

msgbox 0, DT_GetWeekDayName(DT_GetWeekDay(date$), %DT_USE_SHORT_FORM),"", "Today is: " '---results "Fri" '
msgbox 0, DT_CookieDate(0),"","all date and time in a cookie..."

msgbox 0, "Your local Time is: " + $TAB + DT_GetTime(%DT_GETLOCALTIME) + $CRLF + "Your system time: " + $TAB + DT_GetTime(%DT_GETSYSTEMTIME),"","local and system time :) "

printl
printl "-- push any key to exit, thanks!-- "
waitkey


nice to know more about date and time :)

a) local and system time (for me: two hours different, that's ok ???)
b) DT_cookieDate()
c) never used this DT module so concentrated, much more is possible ;)

nice Day and Time for all, Lionheardt :D

ps: thank you eros for moving this topic to this place at board :)