Skip to content

InitWithDateTimeFormatString Format Details

Michael Miller edited this page May 11, 2023 · 2 revisions

(under construction)
This topic covers the details of the string format used to parse the given date time string for the method InitWithDateTimeFormatString. This string is expected to be PROGMEM, so wrap with F().

The format tokens:

* - ignore until next char
YY - two digit year, assumes 2000 +
YYYY - four digit year, also assumes 2000+ and will basically ignore the first digit and assume always a 2
M - full month name, arbitrary length until next char
MM - two digit month
MMM - abbreviated month name, 3 chars
DD - two digit day of month
hh - hour
mm - minute
ss - seconds
sssss - seconds with decimal (12.34), the decimal part will be ignored as RtcDateTime does not store sub-seconds values.
z - +hh:mm or Z -
using this will adjust the time to UTC from the time-zone present in the string,
without it, it will ignore the time-zone and return the local
note: + or - must be present before hour/minute time-zone offset in the string.
zzz - time zone abbreviation
using this will adjust the time to UTC from the time-zone present in the string,
without it, it will ignore the time-zone and return the local

Examples:

Clone this wiki locally