Android Code Snippet B4A Y2038 proof ready

The Y2038 problem is getting closer and closer, which is something we can't ignore. So far Linux/Unix haven't solved the problem yet.
Run the following code on my Mysql server would return Null:
SELECT unix_timestamp("2042-01-22 18:25:30");

I'm amazed and surprised to discover that B4A is Y2038 proof already! Below is the code I tried.
B4X:
    Dim y2042 As Long=DateTime.Now+DateTime.TicksPerDay * 365 * 20 'add 20 years to current time
    Log(y2042)
    DateTime.DateFormat="EEEE yyyy-MM-dd hh:mm:ss"
    Log(DateTime.Date(y2042))
output:
2273603328237
Friday 2042-01-17 03:28:48
Long live the B4X!
 

toby

Well-Known Member
Licensed User
Longtime User
I'm using 64-bit Windows 10, which might be a factor.
 

William Lancee

Well-Known Member
Licensed User
Longtime User
B4X uses 64 bit Long integers for datetime. It doesn't matter what computer/device/OS you run it on.
 
Top