[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP OpenVMS DCL Dictionary
F$CVTIME
Converts an absolute or a combination time string to a string of the form yyyy-mm-dd hh:mm:ss.cc. The F$CVTIME function can also return information about an absolute, combination, or delta time string. FormatF$CVTIME ([input_time] [,output_time_format] [,output_field]) Return ValueA character string containing the requested information. Arguments
DescriptionWhen using the F$CVTIME function, you can omit optional arguments that can be used to the right of the last argument you specify; however, you must include commas (,) as placeholders if you omit optional arguments to the left of the last argument you specify.
|
#1 |
---|
$ TIME = F$TIME() $ SHOW SYMBOL TIME TIME = "14-DEC-2002 10:56:23.10" $ TIME = F$CVTIME(TIME) $ SHOW SYMBOL TIME TIME = "2002-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, 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.
#3 |
---|
$ SHOW TIME 27-MAR-2002 09:50:31 $ WRITE SYS$OUTPUT F$CVTIME(,,"DAYOFYEAR") 86 $ WRITE SYS$OUTPUT F$CVTIME(,,"HOUROFYEAR") 2049 $ WRITE SYS$OUTPUT F$CVTIME(,,"MINUTEOFYEAR") 122991 $ WRITE SYS$OUTPUT F$CVTIME(,,"SECONDOFYEAR") 7379476 |
In this example, F$CVTIME returns the values for the following keywords: DAYOFYEAR, HOUROFYEAR, MINUTEOFYEAR, and SECONDOFYEAR.
Previous | Next | Contents | Index |