I have a wstring variable which holds a value of a time("20090106103842") in the format YYYYMMDDHHMMSS.

How can I convert it to a time_t format

Recommended Answers

All 2 Replies

Substring parts out to istringstream to get the values, start adding the seconds up, get difference from Jan 1, 1970 UTC

I think I'd use mktime or one of its equivalents, it calculates a time_t from struct * tm Read the notes about the tm_isdst field.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.