Date Masks
- Last Updated: October 3, 2020
- 1 minute read
- DataDirect Connectors
- ODBC
- Cloudera Impala 7.1
- dBase 7.1
- Flat files/Text 7.1
- MySQL 7.1
- Pervasive (Btrieve) 7.1
- XML 7.1
- Documentation
Date masks tell the driver how a date is stored in a text file. When a value is inserted into a text file, the date is formatted so that it matches the mask. When reading a text file, the driver converts the formatted date into a date data type.
The following table lists the symbols to use when specifying the date mask.
| Symbol | Description |
|---|---|
| m | Output the month’s number (1–12). |
| mm | Output a leading zero if the month number is less than 10. |
| mmm, Mmm, MMM | Output the three-letter abbreviation for the month depending on the case of the Ms (for example, jan, Jan, JAN). |
| mmmm, Mmmm, MMMM | Output the name of the full month depending on the case of the Ms (for example, january, January, JANUARY). |
| d | Output the day number (1–31). |
| dd | Output a leading zero if the day number is less than 10. |
| ddd, Ddd, DDD | Output the three-letter day abbreviation depending on the case of the Ds (for example, mon, Mon, MON). |
| dddd, Dddd, DDDD | Output the name of the full day depending on the case of the Ds (for example, monday, Monday, MONDAY). |
| yy | Output the last two digits of the year. |
| yyyy | Output the full four digits of the year. |
| J | Output the Julian value for the date. The Julian value is the number of days since 4712 BC. |
| \ - . : , (space) | Special characters used to separate the parts of a date. |
| \ | Output the next character. For example, if the mask is mm/dd/yyyy \A\D, the value appears as 10/01/2003 AD in the text file. |
| "string", 'string' | Output the string in the text file. |
The following table shows some example date values, masks, and how the date appears in the text file.
| Date | Mask | Value |
|---|---|---|
| 2003-10-01 | yyyy-mm-dd | 2003-10-01 |
| m/d/yy | 10/1/03 | |
| Ddd, Mmm dd, yyyy | Fri, Oct 01, 2003 |