Results 1 to 6 of 6

Thread: date and time :)

  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    date and time :)

    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...

    [code=thinbasic]uses "UI", "DT"

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

    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...
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: date and time :)

    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:
    [code=thinbasic]
    uses "Console", "DT"

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

    waitkey
    [/code]

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    Re: date and time :)

    thanks petr!

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

    new one:

    [code=thinbasic]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[/code]

    ... 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
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: date and time :)

    Frank,

    answer to your question is on line 3 of the script


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    Re: date and time :)

    the mouse is in the hole was only really too tired... checked it... and runs
    needed only fresh air...

    [code=thinbasic]'--- 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[/code]

    good evening, thanks for little "line 3" advice, petr, ciao, freezing Lionhead
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  6. #6
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    Re: date and time :)

    a little cup of thinbasic coffee with date and time instant powder for the morning

    [code=thinbasic]'--- 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[/code]


    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

    ps: thank you eros for moving this topic to this place at board
    Attached Images Attached Images
    you can't always get what you want, but if you try sometimes you might find, you get what you need

Similar Threads

  1. Date-Time question
    By spiritsoul in forum DT (Date module)
    Replies: 5
    Last Post: 18-11-2008, 22:50

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •