Date and Time Formatting
Date and Time formatting expressions are used by the <<FlatFile>> parser and composer, and Integer, Float, String, and DateTime objects (e.g. see related pages in the box on the right).
The following Date and Time formatting patterns are supported by the Bridge:
Pattern | Description | Example | Remark |
---|---|---|---|
%a | Abbreviated weekday name | Mon | |
%A | Full weekday name | Monday | |
%b | Abbreviated month name | Feb | |
%B | Full month name | February | |
%C | Year / 100 as decimal number [00,99] | 20 | |
%d | Day of the month as decimal number [01,31] | 12 | |
%D | Equivalent to %m/%d/%y | 02/12/18 | |
%e | Day of the month, single digits with leading space [1,31] | 12 | |
%F | Equivalent to %Y-%m-%d (ISO 8601:2000 standard date format) | 2018-02-13 | |
%h | Equivalent to %b | Feb | |
%H | Hour (24-hour clock) as decimal number [00,23] | 15 | |
%i | Microseconds as decimal number [000000,999999] | 123456 | |
%I | Hour (12-hour clock) as decimal number [01,12] | 03 | |
%j | Day of the year as decimal number [001,366] | 043 | Conflicts with %u , %w , %U , %V , and %W . |
%m | Month as a decimal number [01,12] | 02 | |
%M | Minute as a decimal number [00,59] | 20 | |
%n | <newline> | \n | |
%o | Offset from UTC as +HH:MM | +00:00 | Only for DateTime composing/printing. |
%p | am or pm (12-hour clock) | pm | |
%r | Time in am/pm notation, equivalent to %I:%M:%S %p | 03:20:12 pm | |
%R | Time in 24-hour notation, equivalent to %H:%M | 15:20 | |
%S | Second as decimal number [00,59] | 12 | |
%t | <tab> | \t | |
%T | Time in 24-hour notation, equivalent to %H:%M:%S | 15:20:12 | |
%u | Weekday as decimal number [1,7], with 1 representing Monday | 1 | |
%U | Week number of the year as decimal number [01,53]. The first Sunday of January is the first day of week 1; days in the new year before this are in week 0. | 06 | |
%v | Equivalent to %e-%b-%Y | 12-Feb-2018 | |
%V | Week number of the year as decimal number [01,53]. If the week containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, is the last week of the previous year, and the next week is week 1. Both January 4th and the first Thursday of January are always in week 1. | 07 | |
%w | Weekday as a decimal number [0,6], with 0 representing Sunday | 1 | |
%W | Week number of the year as decimal number [01,53]. The first Monday in January is the first day of week 1; days in the new year before this are in week 0. | 07 | |
%y | Last two digits of the year as decimal number [00, 99] | 18 | |
%Y | Year as decimal number [0000,9999] | 2018 | |
%z | Locale time zone as offset from UTC in ISO 8601:2001 standard format (+hhmm or -hhmm). | +0100 | |
%+ | Equivalent to %a, %d %b %Y %H:%M:%S %z (see also rfc2822 below) | Mon, 12 Feb 2018 15:20:12 +0000 | Only for DateTime composing/printing. |
%% | Percent sign | % | Only for DateTime parsing. |
Standard Patterns
Some very common patterns can be directly abbreviated:
Constant | Equivalent Placeholder Expression | Example | Remark |
---|---|---|---|
rfc822 | %a, %d %b %y %H:%M:%S %z | Mon, 12 Feb 2018 15:20:12 +0000 | Not fully compatible, because %z accepts only the ((+|-)hhmm) format and %y counts year differently. |
rfc850 | %A, %Y-%m-%d %H:%M:%S GMT | Monday, 2018-02-12 15:20:12 GMT | |
rfc1123 | %a, %d %b %Y %H:%M:%S GMT | Mon, 12 Feb 2018 15:20:12 GMT | |
rfc2822 | %a, %d %b %Y %H:%M:%S %z | Mon, 12 Feb 2018 15:20:12 +0000 | Not fully compatible because %z accepts only the ((+|-)hhmm) format and %y counts year differently. (See also %+ above.) |
sap-idoc-dats | %Y%m%d | 20180212 | |
sap-idoc-tims | %H%M%S | 152012 | |
Constant | Parsed Expression | Example | Remark |
xsd:date | CCYY-MM-DD[Z|[+\|-]hh:mm] | 2018-02-12Z | |
xsd:dateTime | CCYY-MM-DDThh:mm:ss[.sss][Z|[+\|-]hh:mm] | 2018-02-12T15:20:12.153688Z | Microseconds are skipped if 0: 2018-02-12T15:20:12Z |
xsd:time | hh:mm:ss[.sss][Z|[+\|-]hh:mm] | 15:20:12.224376Z | Microseconds are skipped if 0: 15:20:12Z |
Unsupported Patterns
The following patterns are not supported - neither for parsing nor composing:
%c
, %g
, %G
, %k
, %l
, %x
, %X
, %Z
.