R RB Smissaert Well-Known Member Licensed User Longtime User Apr 14, 2018 #1 Using the latest DateUtils library, 1.05. Running this code: B4X: Dim lDate As Long lDate = DateUtils.SetDate(1970,1,1) Log(lDate) I expect this to produce 0, but instead I get 3600000 Any idea what I might be doing wrong? RBS
Using the latest DateUtils library, 1.05. Running this code: B4X: Dim lDate As Long lDate = DateUtils.SetDate(1970,1,1) Log(lDate) I expect this to produce 0, but instead I get 3600000 Any idea what I might be doing wrong? RBS
R RB Smissaert Well-Known Member Licensed User Longtime User Apr 15, 2018 #2 RB Smissaert said: Using the latest DateUtils library, 1.05. Running this code: B4X: Dim lDate As Long lDate = DateUtils.SetDate(1970,1,1) Log(lDate) I expect this to produce 0, but instead I get 3600000 Any idea what I might be doing wrong? RBS Click to expand... Sorry, that should be -3600000 RBS Upvote 0
RB Smissaert said: Using the latest DateUtils library, 1.05. Running this code: B4X: Dim lDate As Long lDate = DateUtils.SetDate(1970,1,1) Log(lDate) I expect this to produce 0, but instead I get 3600000 Any idea what I might be doing wrong? RBS Click to expand... Sorry, that should be -3600000 RBS
Erel B4X founder Staff member Licensed User Longtime User Apr 15, 2018 #3 RB Smissaert said: Any idea what I might be doing wrong? Click to expand... Yes, a similar issue is explained in this tutorial: Tip: if you need to make "corrections" to the time zone effects then you are doing something wrong. Upvote 0
RB Smissaert said: Any idea what I might be doing wrong? Click to expand... Yes, a similar issue is explained in this tutorial: Tip: if you need to make "corrections" to the time zone effects then you are doing something wrong.
R RB Smissaert Well-Known Member Licensed User Longtime User Apr 15, 2018 #4 Erel said: Yes, a similar issue is explained in this tutorial: Tip: if you need to make "corrections" to the time zone effects then you are doing something wrong. Click to expand... OK, thanks. I wrongly presumed that DST wouldn't affect DateUtils.SetDate(1970,1,1). I solved this now with a Public variable (set once in Sub Service_Create): B4X: General.lTicksOff = DateUtils.SetDate(1970, 1, 1) Now this function works fine: B4X: Public Sub Ticks2ExcelDate(lTicks As Long) As Long Return 25569 + ((lTicks - lTicksOff) / 86400000) End Sub RBS Upvote 0
Erel said: Yes, a similar issue is explained in this tutorial: Tip: if you need to make "corrections" to the time zone effects then you are doing something wrong. Click to expand... OK, thanks. I wrongly presumed that DST wouldn't affect DateUtils.SetDate(1970,1,1). I solved this now with a Public variable (set once in Sub Service_Create): B4X: General.lTicksOff = DateUtils.SetDate(1970, 1, 1) Now this function works fine: B4X: Public Sub Ticks2ExcelDate(lTicks As Long) As Long Return 25569 + ((lTicks - lTicksOff) / 86400000) End Sub RBS