# 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}
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olddocs.exivity.io/3.5.4/data-pipelines/extract/subroutines/format_date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
