GETDATE

Purpose: Retrieve the current local date.

Format:    GETDATE     year     month     day     <$Month>     <$DayofWeek>

Notes:    When this command is executed,  the local date will be returned in the selected variables.  These must be valid numeric variable names. The  year,  month and  day  parameters are required.  The  $Month  and     $DayofWeek  parameters must be valid text variable names and are optional.  Use these to obtain the text values (i.e. January and Friday, etc.).
 

Example:

# Example 1: Get the date and pop it up in a box.

getdate year month day $Month $Day

$text = "Today is: " $Day "  -  "$Month ", " day ", " year
pause $text

# Example 2: Create a filename based on the time and date
# and create a file with a time stamp.

getdate year month day $Month $Day
gettime hour min sec msec

$text = hour ":" min ":" sec ":" msec "  " $Day " - " $Month " " day ", " year

# Build the filename using yyyy mm dd hh mm ss millisecs

$filename = year

value = month
gosub convert
value = day
gosub convert
value = hour
gosub convert
value = min
gosub convert
value = sec
gosub convert

# Pad the millisecs here

msec = msec + 1000
$temp = msec
mid $digits $temp 1 3
$filename = $filename $digits ".txt"

# Write the file and display it

print_file $filename
fprint $text
$cmd = "notepad.exe " $filename
exec $cmd
exit

# Pad single digits with a zero and add
# it the end of the text string

*Convert
 $digits = value
 if value < 10
  value = value + 100
  $temp = value
  mid $digits $temp 1 2
 endif
$filename = $filename $digits
Return

See Also:  GETTIME