Convert string time to UNIX timestamp
I have a string like 2013-05-29T21:19:48Z . I'd like to convert it to the number of seconds since 1 January 1970 (the UNIX epoch), so that I can save it using just 4 bytes (or maybe 5 bytes, to avoid the year 2038 problem). How can I do that in a portable way? (My code has to run both on Linux and Windows.) I can get the date parts out of the string, but I don't know how to figure out the number of seconds. I tried looking at the documentation of date and time utilities in C++ , but I didn't find anything. use std::get_time if you want the c++ way - but both other options are also valid.