I get a timestamp as an AnsiString from my database in my C++ application. It looks like this "2017-09-12 09:35:10".
Now I want to parse it back into an Unix Timestamp.
AnsiString myDate = Query->Fields->FieldByName("MyDates")->AsString;
TDateTime = StrToDateTime(myDate);
In my specific case I get the following date: 2017-08-10 08:43:35
But the Unixtimestamp I get is: 42957.363599537
Which is 01-01-1970 12:55:57 calculated back into readable format.
What am I missing here?!...
You could try Howard Hinnant's free, open source, header-only, date/time library which extends the C++11
<chrono>
header to handle calendrical computations.Output: