<< Click to Display Table of Contents >> Navigation: 5. Detailed description of the Actions > 5.1. General Parameters used in many actions > 5.1.3. Dates |
Dates fields are typically received in input of an Anatella Data Transformation graphs as simple Strings.
You can convert Dates-stored-as-String to Date-stored-as-Key using the ChangeDataType Action. All computations on Dates-stored-as-Key are a lot faster than on Dates-stored-as-String. The memory consumption of Dates-stored-as-Key is also significatively smaller (and thus better). When working on large data volume, it’s strongly suggested to rather use Date-stored-as-Key, to have the best speed and the lowest hard drive & RAM memory consumption.
There exist many Actions in Anatella that can directly use Dates-stored-as-Strings:
(sort) (dateTimeFormatter) (transformToAge)
(valueBackInTime) (customerAggregate) (ChangeDataType)
Inside these actions, we’ll need to provide the Date Format, so that Anatella can interpret the date correctly.
A date format is composed of two parts:
1.The first part specifies the date of the day (for example: March 24th, 2010).
2.The second part specifies the time in the day (for example: noon: 12:00)
For the first part of the “date format”, these expressions may be used:
Expression |
Output |
---|---|
d |
the day as number without a leading zero (1 to 31) |
dd |
the day as number with a leading zero (01 to 31) |
ddd |
the abbreviated localized day name (e.g. 'Mon' to 'Sun'). |
dddd |
the long localized day name (e.g. 'Monday' to 'Sunday'). |
M |
the month as number without a leading zero (1-12) |
MM |
the month as number with a leading zero (01-12) |
MMM |
the abbreviated localized month name (e.g. 'Jan' to 'Dec'). |
MMMM |
the long localized month name (e.g. 'January' to 'December'). |
yy |
the year as two digit number (00-99) |
yyyy |
the year as four digit number |
About Localized day name and Localized month name
Day and Month names must be given in the user's local language. It is only possible to use the English names if the user's language on the computer is English.
For the second part of the “date format”, these expressions may be used:
Expression |
Output |
---|---|
h |
the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) |
hh |
the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) |
H |
the hour without a leading zero (0 to 23, even with AM/PM display) |
HH |
the hour with a leading zero (00 to 23, even with AM/PM display) |
m |
the minute without a leading zero (0 to 59) |
mm |
the minute with a leading zero (00 to 59) |
s |
the second without a leading zero (0 to 59) |
ss |
the second with a leading zero (00 to 59) |
z |
the milliseconds without leading zeroes (0 to 999) |
zzz |
the milliseconds with leading zeroes (000 to 999) |
AP or A |
interpret as an AM/PM time. AP must be either "AM" or "PM". |
ap or a |
Interpret as an AM/PM time. ap must be either "am" or "pm". |
For any field that is not represented in the format the following defaults are used:
Field |
Default value |
---|---|
Year |
1900 |
Month |
1 (January) |
Day |
1 |
Hour |
0 |
Minute |
0 |
Second |
0 |
The expressions that don't have leading zeroes (d, M, h, m, s, z) will be greedy. This means that they will use two digits even if this will put them outside the range and/or leave too few digits for other sections.
Some examples:
Content of data table |
Date format |
value |
---|---|---|
131 |
HHh |
13:00:00 |
1apA |
1amAM |
01:00:00 |
M1d1y9800:01:02 |
'M'M'd'd'y'yyhh:mm:ss |
1 January 1998 at 00:01:02 |
130 |
Mm |
<invalid> |
1.30.1 |
M.d.s. |
30 January 1900 at 00:00:01 |