Now

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > Date and Time >

Now

 

Description

 

Retrieve the system date and time

 

Syntax

 

s = Now [(lFormat)]

 

Returns

 

String: Returned format: DD/MM/YYYY HH:MM:SS

 

Parameters

 

Name

Type

Optional

Meaning

lFormat

Numeric

Yes

By default (without any lFormat specification) returned date will have the following format: DD/MM/YYYY HH:MM:SS

 

Possible other formatting types:

0MM-DD-YYYY HH:MM:SS
1YYYY/MM/DD
2DD/MM/YYYY HH:MM:SS
3YYYY-MM-DD

 

10YYYY-MM-DD HH:MM:SS
11YYYYMMDD_HHMMSS

 

20YYYYMMDDHHMMSS

 





 

Remarks

 

Restrictions

 

See also

 

String Handling, TIME$, TIMER, DateTime$,

 

Examples

 

Thanks to Abraxas for the following script example

' Usage of the DATE$ Instruction example

' Usage of the TIME$ Instruction example

' Usage of the TIMER Instruction example

 

Dim Year  As String

Dim Month As String

Dim Day   As String 

Dim sMsg  As String

 

' I dont know if this changes depending on your system setup ???

Year  = mid$(Date$, 7, 4) ' Extract the year from the returned string

Month = mid$(Date$, 1, 2) ' Extract the Month from the returned string 

Day   = mid$(Date$, 4, 2) ' Extract the Day from the returned string

 

sMsg += " Current Year "  & Year  & $CRLF

sMsg += " Current Month " & Month & $CRLF

sMsg += " Current Day "   & Day   & $CRLF

 

sMsg += " Current Time " & TIME$ & $CRLF ' returns the time as a string

sMsg += " Seconds Since Midnight " & TIMER & $CRLF ' returns the second as a number

 

MSGBOX 0, sMsg