@DATETIME

Top  Previous  Next

Syntax:

 

@DATETIME(<format-string> , <time-value> )

 

Description:

 

This function returns the current date and/or time (or if <time-value> is given, the date and/or time corresponding to <time-value>) formatted in accordance with <format-string>. If no format is specified, the value returned is a floating point number. If a <time-value> is specified that is not a formatted date, it must also be in this format.

Also, two digit dates are "windowed" so that years 00 - 79 are assumed to be in the next millennium. This window date can be changed using OPTION CENTURYWINDOW.

Format strings may be made up of:

d

returns day number without leading zero

dd

returns day number with leading zero

ddd

returns day as an abbreviation e.g. Mon

dddd

returns full name of day e.g. Monday

ddddd

returns date using Windows' Short Date style (set in Control Panel)

dddddd

returns date using Windows' Long Date style (set in Control Panel)

m

returns month number without leading zero

mm

returns month number with leading zero

mmm

retuns month as an abbreviation e.g. Jan

mmmm

returns full name of month e.g. January

yy

returns year as two digit number

yyyy

returns year as four digit number

h

returns hour without leading zero

hh

returns hour with leading zero

nn

returns minute (note: not mm)

ss

returns seconds

t

returns time using Windows' Short Time style (set in Control Panel)

tt

returns time using Windows' Long Time style (set in Control Panel)

am/pm

uses 12 hour clock and displays am or pm as appropriate

a/p

uses 12 hour clock and displays a or p as approprate

/

returns date separator as set in Control Panel

:

returns time separator as set in Control Panel

ampm

returns AM symbol or PM symbol as set in Control Panel

 

Spaces and other separator characters (e.g. the current field separator) can be included in the format string.

 

OK:

 

Unchanged.

 

Example:

 

%D = @DATETIME(t dddd ddddd, %F)

PARSE "%H;%M;%S",@datetime(hh|mm|ss)