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.
Post
Replies
Boosts
Views
Activity
For example I created a project aaa.
aaa source folder is called aaa.
that is
aaa
aaa/aaa
then I put a data file in
aaa/aaa/some.data
now i want to test data in
aaa/aaaTests/aaaTests.swift
How can i access aaa/aaa/some.data in aaaTests.swift?
If I want to access some.data inside aaa/aaa/ContentView.swift, how to write the code?
I have been searching google and bing for days, but find no example answering my questions.
Can anyone help me out?
Thanks in advance.