These functions are used to convert a disk object or system time to different formats.
CURRENT TIME
function: acquire the current time
time=Current Time
This function contains the current time. This is NOT a value in the standard DOS-format as this one would require two longwords.
For everyone, who's interested: the time is created out of Wordswap(minutes)+ticks.
CT TIME$
function: create a complete time string
time$=Ct Time$(time)
This very handy function converts the normal parameter 'time' into a string in the format 'HH:MM:SS'.
CT HOUR
function: extract the hour from a time
hour=Ct Hour(time)
This function separates the hour from the packed time.
CT MINUTE
function: return the minute of a time stamp
minute=Ct Minute(time)
This function returns the number of minutes passed out from the Longword 'time'.
CT SECOND
function: calculate the second of a time
second=Ct Second(time)
The Ct Second function returns the number of seconds from the parameter 'time'.
CT TICK
function: extract the number of vertical blanks from the time
tick=Ct Tick(time)
Calculates the number of vertical blanks (=1/50 of a second) from the parameter 'time'.
CT STRING
function: evaluate a string into a time code
time=Ct String(time$)
This function will evaluate the valid time in the time$ string and then return the time as number or -1, if the string has been invalid.
The time string has to be in the format "HH:MM" or "HH:MM:SS".
This command only works on OS2.0 and higher.
CURRENT DATE
function: return the current date
date=Current Date
This command returns the current system date. This value counts the days passed since 1st January 1978.
To separate the number of years, months and day there certainly are many supporting functions.
CD DATE$
function: create a complete date string
date$=Cd Date$(date)
This simple function returns the date stamp 'date' as string in the format 'WWW DD-MMM-YY'.
CD YEAR
function: return the year from a date
year=Cd Year(date)
This function returns the year out from the DOS date stamp 'date'.
CD MONTH
function: return the month from a date
month=Cd Month(date)
Cd Month calculates the month of the argument 'date'. 'month' therefore lies between 1 and 12.
CD DAY
function: return the day from the date stamp
day=Cd Day(date)
This function returns the day in the month of the date stamp parameter 'date'. The result 'day' will be a value between 1 and 31.
CD WEEKDAY
function: return the weekday from the date stamp
weekday=Cd Weekday(date)
This function returns the weekday of the parameter 'date'. 'weekday' can range between 1 (monday) and 7 (sunday).
CD STRING
function: return a date stamp from a valid string
date=Cd String(date$)
This function will evaluate the valid date in the date$ string and then return the date stamp or -1, if the string
has been invalid.
The string has to be in the format "DD-MMM-YY" or "DD-month-YY".
Strings like "Today" or "Tomorrow" are also allowed, weekday strings refer to the last occurrence of the week.
EG: "Monday" represents last monday and not next monday.
Note: This command only works on OS2.0 and higher.