Is there a C/C++/STL/Boost clean method to convert a date time string to epoch time (in seconds)?
yyyy:mm:dd hh:mm:ss
boostc++datetimestl
Is there a C/C++/STL/Boost clean method to convert a date time string to epoch time (in seconds)?
yyyy:mm:dd hh:mm:ss
Best Answer
See: Date/time conversion: string representation to time_t
And: [Boost-users] [date_time] So how come there isn't a to_time_t helper func?
So, apparently something like this should work:
But I don't think it's much cleaner than Rob's suggestion: use
sscanf
to parse the data into astruct tm
and then callmktime
.