Post marked as solved
Post marked as solved with 1 replies, 368 views
I get and int unix timestamp from database
and convert it to timeinterval as some instructions said.
But the result date is not correct.
the code is as follows:
let dateValue = try join.get(examDate);
print (dateValue)
let timeInterval = TimeInterval(dateValue);
print(timeInterval)
let date = Date(timeIntervalSince1970: timeInterval)
print(date)
the result is as follows:
1709942400000
1709942400000.0
56155-12-02 00:00:00 +0000
by converting 1709942400000 with js Date, we got the value:
>new Date(1709942400000)
2024-03-09T00:00:00.000Z
How can I properly convert unix timestamp to Date object?
Thanks in advance.