The DATE system variable always contains the current date in 'separated date format' as given below.
Note that in order to split the DATE system variable out into the individual fields, you have to assign it to a B,4 variable that overlayss the 4 byte structure (BDATE in the example above). Setting SDATE = DATE will not work, since SDATE is an unformatted variable, which will result in a data conversion during the assignment.
You may also use the formal structure ST_SEPDATE defined in ashell.sdf as:
defstruct ST_SEPDATE ! standard separated date format
map2 sdate
map3 mon,b,1 ! month of year (1-12)
map3 day,b,1 ! day of month (1-31)
map3 yr,b,1 ! year - 1900
map3 dow,b,1 ! day of week (0=mon, 6=sun)
map2 sysdate,b,4,@sdate ! use for assigning from DATE sys var
endstruct
For example...
++include ashinc:ashell.sdf
map1 birthdate, ST_SEPDATE
birthdate.sysdate = DATE
? "month: ";birthdate.mon; ", day: ";birthdate.day; ", year: "; (1900+birthdate.yr)
See Also: