ISO8601 timestamp to datetime

I am getting a datetime string from a webserver that is in ISO 8601 format:


I need to get it in to a format that rtclib can understand.

Here is an example of what that would look like:

 if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

I’m not sure how to accomplish this. Any help would be appreciated.

One way to interpret that is to read the date string into a character buffer e.g. :

char mydate[ 32 ] ; // check this is long enough.

Then use atoi() to pick the values out.