jeudi 28 avril 2022

using get_time to parse string, part of the format doesn't seem to register

I'm trying to parse a string of date with the format seconds:minutes:hour:dayInMonth:month:year

For example: 58:48:20:12:8:1905

The code:

        struct std::tm time{};
        std::istringstream stream(timeString);
        stream >> std::get_time(&time, "%S:%M:%H:%d:%m:%Y");

timeString value is the time values and I've checked that it is as I expect. get_time puts the values of seconds:minutes:hour:dayInMonth correctly inside the time variable but the month:year values are not parsed and remain 0 in the variable. I've tried other formats such as %mm:%YYYY but it didn't fix the issue.

Help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire