/sys$common/syshlp/helplib.hlb Lexicals, F$CVTIME, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1.$ TIME = F$TIME() $ SHOW SYMBOL TIME TIME = "14-DEC-2001 10:56:23.10" $ TIME = F$CVTIME(TIME) $ SHOW SYMBOL TIME TIME = "2001-12-14 10:56:23.10" This example uses the F$TIME function to return the system time as a character string and to assign the time to the symbol TIME. Then the F$CVTIME function is used to convert the system time to an alternate time format. Note that you do not need to place quotation marks (" ") around the argument TIME because it is a symbol. Symbols are automatically evaluated when they are used as arguments for lexical functions. You can use the resultant string to compare two dates (using .LTS. and .GTS. operators). For example, you can use F$CVTIME to convert two time strings and store the results in the symbols TIME_1 and TIME_2. You can compare the two values, and branch to a label, based on the following results: $ IF TIME_1 .LTS. TIME_2 THEN GOTO FIRST 2.$ NEXT = F$CVTIME("TOMORROW",,"WEEKDAY") $ SHOW SYMBOL NEXT NEXT = "Tuesday" In this example, the F$CVTIME returns the weekday that corresponds to the absolute time keyword "TOMORROW". You must enclose the arguments "TOMORROW" and "WEEKDAY" in quotation marks because they are character string expressions. Also, you must include a comma as a placeholder for the output_time_ format argument that is omitted.
|