/ lang / cdate
CDate
Syntax

    Date = CDate ( Expression AS Variant ) AS Date

Converts an expression (numerical Float or String) into a Date / Time String.

| Be careful! The current localization is not used by this function.

### Errors

Message | Description
--- | ---
Type mismatch (#6) | Expression cannot be converted.

### Examples

    PRINT CDate("09/06/1972 01:45:12")
    <hr>09/06/1972 01:45:12

    PRINT CDate(2484515)
    <hr>05/16/2002

- If the expression is numeric, and is below 1.0000 then only a time is returned in the format "hh:mm:ss".
- If the expression is numeric, and is greater than 1.0000 and its fraction is 0.00 then only the Date is returned in a european short format. "dd.mm.yy"
- If the expression is numeric, and is greater than 1.0000 and its fraction is not 0.00 then the Date and the time is returned in a european short format. "dd.mm.yyyy hh:mm:ss".

    CDate(86398/86400)          23:59:58
    CDate(1.2)                  01.01.-4801 04:48:00
    CDate(-0.25)                18:00:00
    CDate(-1.25)                18:00:00
    CDate(-500 + 3 / 86400)     00:00:03
    CDate(2472692)              01.01.70
    CDate(2472693)              02.01.70
    CDate(2472693 + 1 / 86400)  02.01.1970 00:00:01
    CDate(2472693 + 1 / 1440)   02.01.1970 00:01:00
    CDate(2472693.25)           02.01.1970 06:00:00

### See also

Conversion Functions