format_date

This Subroutine extracts the day, month and year from a given date in YYYYMMDD format.

Syntax

gosub format_date ("YYYYMMDD")

Code Snippet

subroutine format_date {
    match day "^[0-9]{6}([0-9]{2})" ${SUBARG_1}
    if (${day.STATUS} != MATCH) {
        terminate with error
    } else {
        var day = ${day.RESULT}
    }
    match month "^[0-9]{4}([0-9]{2})[0-9]{2}" ${SUBARG_1}
    if (${day.STATUS} != MATCH) {
        terminate with error
    } else {
        var month = ${month.RESULT}
    }
    match year "^([0-9]{4})[0-9]{4}" ${SUBARG_1}
    if (${year.STATUS} != MATCH) {
        terminate with error
    } else {
        var year = ${year.RESULT}
    }
}

Last updated