New in version 6.4.0: See the new features.

Converting a text expression to dateΒΆ

todate()

Converting a text expression to date


SYNTAX

todate(text_expression)

This function converts text_expression into a date (i4/dn datatype). It is a convenient helper method that permits date comparisons of dates held in strings against dates in standard date fields in the i4/dn format. Previously it was often necessary to convert the string to an i4/dn to get reliable results.

The function returns a numeric value of type i4/dn


EXAMPLE

!define TESTDATE "01/01/2021"
!define TESTDATE_PLUS_ONE "02/01/2021"

!temp tdate,,i4/dn

tdate = TESTDATE

if (tdate = todate(TESTDATE)) {
    info "We can compare the dates using the todate() helper function"
}

if (tdate != TESTDATE) {
    info "While directly the date and string can't be compared"
}

if (tdate < todate(TESTDATE_PLUS_ONE)) {
    info "tdate is previous to " + TESTDATE_PLUS_ONE
}

RELATED TOPICS

Date configuration

Date formats