F$CVTIME()

From VSI OpenVMS Wiki
Revision as of 05:45, 15 January 2019 by Darya.zelenina (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

F$CVTIME() is a lexical function that 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.

Format

F$CVTIME([input_time] [,output_time_format] [,output_field])

input_time

Specifies a string containing absolute, delta, or combination time, or TODAY, TOMORROW, or YESTERDAY. Specify the input time string as a character string expression (use quotes).

If the input_time argument is omitted or is specified as a null string (""), the current system date and time, in absolute format, is used. If parts of the date field are omitted, the missing values default to the current date. If parts of the time field are omitted, the missing values default to zero.

If the input_time argument is a delta time, you must specify the output_time_format as "DELTA".

output_time_format

Specifies the time format for the information you want returned. Specify the output_time_format argument as one of the following character string expressions:

  • ABSOLUTE: the requested information should be returned in absolute time format, which is dd-mmm-yyyy hh:mm:ss.cc. Single-digit days are returned with no leading space or zero.
  • COMPARISON: the requested information should be returned in the (default) form yyyy-mm-dd hh:mm:ss.cc (used for comparing two times).
  • DELTA: te requested information should be returned in delta format, which is dddd-hh:mm:ss.cc. If you specify DELTA as the output_time_format argument, then you must also provide a delta time specification for the input_time argument.


output_field

What should be returned by the function. Specifies a character string expression containing one of the following (do not abbreviate):

  • DATE
  • MONTH (does not work with delta time)
  • DATETIME (default)
  • SECOND
  • DAY
  • TIME
  • HOUR
  • WEEKDAY (does not work with delta time)
  • HUNDREDTH
  • YEAR (does not work with delta time)
  • MINUTE
  • DAYOFYEAR (does not work with delta time)
  • HOUROFYEAR (does not work with delta time)
  • MINUTEOFYEAR (does not work with delta time)
  • SECONDOFYEAR (does not work with delta time)

The information is returned in the time format specified by the output_time_format argument. If the input_time argument is a delta time and the output_time_ format argument is DELTA, you cannot specify MONTH, WEEKDAY, YEAR, DAYOFYEAR, HOUROFYEAR, MINUTEOFYEAR, or SECONDOFYEAR.

When the weekday is returned, the first letter is in uppercase,and the following letters are in lowercase.

Examples

$ NEXT = F$CVTIME("TOMORROW",,"WEEKDAY")

$ SHOW SYMBOL NEXT

NEXT = "Tuesday"


$ WRITE SYS$OUTPUT F$CVTIME("TOMORROW","ABSOLUTE","DATE")

16-AUG-2018


$ write sys$output f$cvtime("2-3","delta","hour")
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