CDate Function [Runtime]

From LibreOffice Help
Jump to: navigation, search

Converts any string or numeric expression to a date value.


CDate (Expression)

Return value:



Expression: Any string or numeric expression that you want to convert.

When you convert a string expression, the date and time must be entered in the format MM.DD.YYYY HH.MM.SS, as defined by the DateValue and TimeValue function conventions. In numeric expressions, values to the left of the decimal represent the date, beginning from December 31, 1899. Values to the right of the decimal represent the time.

Error Codes

5 Invalid procedure call


Sub ExampleCDate
    MsgBox cDate(1000.25) ' 09.26.1902 06:00:00
    MsgBox cDate(1001.26) ' 09.27.1902 06:14:24
End Sub