'Parts of can easily be pasted into other scripts to format dates in those scripts.
DECLARE FUNCTION SCRIPTDATETODOSDATE LIB "oleaut32" ( BYVAL time AS DATE, BYREF dosdate AS INTEGER, BYREF dostime AS INTEGER) AS LONG ALIAS "VariantTimeToDosDateTime"
DECLARE FUNCTION DOSDATETOFILETIME LIB "kernel32" ( BYVAL dosdate AS INTEGER, BYVAL dostime AS INTEGER, BYREF FILETIME AS STRING) AS INTEGER ALIAS "DosDateTimeToFileTime"
DECLARE FUNCTION FILETIMETOSYSTEMTIME LIB "kernel32" ( BYREF filetime AS STRING, BYREF systemtime AS STRING) AS INTEGER ALIAS "FileTimeToSystemTime"
DECLARE FUNCTION GETDATEFORMAT LIB "kernel32" (BYVAL Locale AS LONG, BYVAL Flags AS LONG, BYREF datetime AS STRING, BYREF format AS STRING, datestr as STRING, BYVAL bufsize AS LONG ) AS LONG ALIAS "GetDateFormatA"
DECLARE FUNCTION GETTIMEFORMAT LIB "kernel32" (BYVAL Locale AS LONG, BYVAL Flags AS LONG, BYREF datetime AS STRING, BYREF format AS STRING, timestr as STRING, BYVAL bufsize AS LONG ) AS LONG ALIAS "GetTimeFormatA"
' Local functions
DECLARE FUNCTION formatdate ( BYVAL datetime AS DATE, BYVAL dateformat AS STRING, BYVAL timeformat AS STRING ) AS STRING