Home Previous section Next section

Getting the current date and time


To get the current time, use the TIME$ command.
    PRINT TIME$

The above example returns "military" time. See the following figure:
    hour 00 = 12 a.m. (midnight)
    hours 01-11 = a.m.
    hours 12-23 = p.m.

You can also use TIME$ to set the time.
    TIME$ = "15:30:00"  ' Sets current time to 3:30 p.m.

Date

To find out the current date, use the DATE$ function.
    PRINT DATE$

Like TIME$, you can also set the date.
    DATE$ = "01/01/2000"

TIMER

Use TIMER to get the number of seconds since midnight.

    PRINT TIMER
Output:
    43199.99  (Just before noon)

Next section


Feel free to distribute this tutorial, upload it to your website, link to it from your site, etc.

http://www.geocities.com/progsharehouse/qbtutor
Mirror: http://development.freeservers.com/qbtutor