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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
sscanfto parse the data into astruct tmand then callmktime.