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

Syntax

1
gosub format_date ("YYYYMMDD")
Copied!

Code Snippet

1
subroutine format_date {
2
match day "^[0-9]{6}([0-9]{2})" ${SUBARG_1}
3
if (${day.STATUS} != MATCH) {
4
terminate with error
5
} else {
6
var day = ${day.RESULT}
7
}
8
match month "^[0-9]{4}([0-9]{2})[0-9]{2}" ${SUBARG_1}
9
if (${day.STATUS} != MATCH) {
10
terminate with error
11
} else {
12
var month = ${month.RESULT}
13
}
14
match year "^([0-9]{4})[0-9]{4}" ${SUBARG_1}
15
if (${year.STATUS} != MATCH) {
16
terminate with error
17
} else {
18
var year = ${year.RESULT}
19
}
20
}
Copied!
Last modified 5mo ago
Export as PDF
Copy link