Format Datetime


Converts a datetime value to the text.

Parameters

  • Datetime Specifies the datetime value.

  • Format string type Specifies how to format the datetime, and it can use the system default format string.

  • Date format string Specifies the format string for the date part, and it can be "none" to ignore the date part of the datetime.

  • Time format string Specifies the format string for the time part, and it can be "none" to ignore the time part of the datetime.

  • Populate variable with converted text Specifies a variable to hold the converted string.

Notes

  • The below table lists the notations to be used to specify how dates and times are displayed:

  • Time notations

    Displays

    h

    Hour (hh displays the hour with a leading zero)

    m

    Minute (mm displays the minute with a leading zero)

    s

    Second (ss displays the second with a leading zero)

    tt

    A.M. or P.M.

    h

    12 hour time display (hh displays the hour with a leading zero)

    H

    24 hour time display (HH displays the hour with a leading zero)

    Date notationsThis

    Displays

    d

    Day (dd displays the day with a leading zero)

    dddd

    Day of the week

    M

    Month (MM displays the month with a leading zero)

    MMMM

    Full month name

    yy

    Year in short format

    yyyy

    Year in long format