How do I convert a date string, formatted as "MM-DD-YY HH:MM:SS"
, to a time_t
value in either C or C++?
Use strptime()
to parse the time into a struct tm
, then use mktime()
to convert to a time_t
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With