Returns the datetime representation of expr based on the fmt string or the default for expr's data type. If expr is already a datetime, the value is not converted.

The expr can be an integer or numeric value.

  • If expr is an integer value, it represents the number of days since year zero.
  • If expr is a numeric, the integer portion represents the number of days since year zero, and the fractional portion represents the part of the last day.
  • If expr is a char value, fmt can be:
    YYYY Four-digit year
    YY Two-digit year
    RR Two-digit year in another century
    MM Two-digit month of year (01 to 12)
    MON Three-character month (all uppercase)
    mon Three-character month (all lowercase)
    Mon Three-character month (initial cap)
    DDD Three-digit day of year (001 to 356)
    DD Two-digit day of month (01 to 31)
    HH12 Two-digit hour (00 to 11)
    HH,HH24 Two-digit hour (00 to 23)
    MI Two-digit minutes (00 to 59)
    SS Two-digit seconds (00 to 59)
    SSSSS Seconds past midnight (0000 to 86399)
    J Days since 1/1/1
    other Delimiting character