Xbasic

Date and Time Conversion Matrix

Description

A list of Inputs and Outputs relating to date time functions.

Date Input

Symbol D

 Output Type

    •  Now

      Symbol

      D

      Function

      DATE()

    •  Date String

      Symbol

      C

      Function

      DTOC( Date_Value )

    •  Year

      Symbol

      N

      Function

      YEAR( Date_Value )

    •  Month

      Symbol

      C

      Function

      DATE_FORMAT( Date_Value, "Month")

    •  Month of Year

      Symbol

      N

      Function

      MONTH( Date_Value )

    •  Week of Year

      Symbol

      N

      Function

      WEEK( Date_Value )

    •  Day

      Symbol

      C

      Function

      DATE_FORMAT( Date_Value, "Weekday")

    •  Last Date of Month

      Symbol

      D

      Function

      MONTH_END( Date_Value )

    •  Day of Month

      Symbol

      N

      Function

      DAY( Date_Value )

    •  Day of Year

      Symbol

      N

      Function

      JDATE( Date_Value ) - JDATE(CTOD("1/1/" + YEAR( Date_Value ))) + 1

    •  Days

      Symbol

      N

      Function

      Date_Value1 - Date_Value2

    •  Business Days in Month

      Symbol

      N

      Function

      BUS_DAYS_BETWEEN(MONTH_STARTt( Date_Value ), MONTH_END( Date_Value ))

    •  Sortable Date Value

      Symbol

      C

      Function

      CDATE( Date_Value )

Date String Input

Symbol C.

 Output Type

  •  Date

    Symbol

    D

    Function

    CTOD( Date_String )

Time Input

Symbol T.

 Output Type

  •  Now

    Symbol

    T

    Function

    NOW()

  •  Time

    Symbol

    C

    Function

    TIME("", Time_Variable )

  •  Year

    Symbol

    N

    Function

    YEAR( Time_Variable )

  •  Month of Year

    Symbol

    N

    Function

    MONTH( Time_Variable )

  •  Week of Year

    Symbol

    N

    Function

    WEEK(DATE_VALUE(YEAR( Time_Variable ), MONTH( Time_Variable ), DAY( Time_Variable )))

  •  Day of Month

    Symbol

    N

    Function

    DAY( Time_Variable )

  •  Hour (12)

    Symbol

    N

    Function

    IF(VAL(TIME("h", Time_Variable )) 12, VAL(TIME("h", Time_Variable )) - 12, VAL(TIME("h", Time_Variable )))

  •  Hour (24)

    Symbol

    N

    Function

    VAL(TIME("h", Time_Variable ))

  •  Minute

    Symbol

    N

    Function

    VAL(TIME("m", Time_Variable ))

  •  Second

    Symbol

    N

    Function

    TIME("s", Time_Variable )

  •  Seconds

    Symbol

    N

    Function

    Time_Variable1 - Time_Variable2

  •  AM/PM

    Symbol

    C

    Function

    TIME("am", Time_Variable )

  •  Date

    Symbol

    D

    Function

    DIM Date_Variable as D Date_Variable = Time_Variable

  •  Short Time

    Symbol

    Y

    Function

    CTOT( Time_Variable )

  •  Character

    Symbol

    C

    Function

    CTIME( Time_Variable )

  •  Sortable Time Value

    Symbol

    C

    Function

    CDATE( Time_Variable ) + TIME("hms", Time_Variable )

Time String Input

Symbol C.

 Output Type

  •  Time

    Symbol

    T

    Function

    CTODT( Time_String )

Short Time Input

Symbol Y.

 Output Type

  •  Now

    Symbol

    Y

    Function

    DIM Short_Time_Variable as Y Short_Time_Variable = NOW()

  •  Hour (12)

    Symbol

    N

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable IF(VAL(TIME("h", Time_Variable )) 12, VAL(TIME("h", Time_Variable )) - 12, VAL(TIME("h", Time_Variable )))

  •  Hour (24)

    Symbol

    N

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable VAL(TIME("h", Time_Variable ))

  •  Minute

    Symbol

    N

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable V AL(TIME("m", Time_Variable ))

  •  Second

    Symbol

    N

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable TIME("s", Time_Variable )

  •  Seconds

    Symbol

    N

    Function

    DIM Short_Time_Variable1 as Y DIM Short_Time_Variable2 as Y Short_Time_Variable1 - Short_Time_Variable2

  •  AM/PM

    Symbol

    C

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable TIME("am", Time_Variable )

  •  Time

    Symbol

    T

    Function

    DIM Time_Variable as T Time_Variable = Short_Time_Variable

  •  Character

    Symbol

    C

    Function

    CShortTime( Short_Time_Variable )

  •  Sortable Short Time

    Symbol

    C

    Function

    TIME("hms", Time_Variable )

  •  Hour (12)

    Symbol

    N

    Function

    IF(ShortTime_Extract( Short_Time_Variable, "h") > 12, ShortTime_Extract( Short_Time_Variable, "h") - 12, ShortTime_Extract( Short_Time_Variable, "h")

  •  Hour (24)

    Symbol

    N

    Function

    ShortTime_Extract( Short_Time_Variable, "h")

  •  Minute

    Symbol

    N

    Function

    ShortTime_Extract( Short_Time_Variable, "m")

  •  Second

    Symbol

    N

    Function

    ShortTime_Extract( Short_Time_Variable, "s")

  •  AM/PM

    Symbol

    C

    Function

    IF(shortTime_extract( Short_Time_Variable,"h") > 11, "pm", "am")

Short Time String Input

Symbol C.

 Output Type

  •  Short Time

    Symbol

    Y

    Function

    CTOT( Short_Time_String )

See Also