H hanyelmehy Well-Known Member Licensed User Longtime User Sep 1, 2024 #1 DateTime.Now return time not match with PC time (-1h) i need simple way to get same PC time ,without any addtional setting
DateTime.Now return time not match with PC time (-1h) i need simple way to get same PC time ,without any addtional setting
Daestrum Expert Licensed User Longtime User Sep 1, 2024 #2 Sounds like a daylight saving setting problem. Are you sure DST is on? (assuming you are in a country that has daylight saving) Upvote 0
Sounds like a daylight saving setting problem. Are you sure DST is on? (assuming you are in a country that has daylight saving)
H hanyelmehy Well-Known Member Licensed User Longtime User Sep 1, 2024 #3 yes we have daylight saving and setting DateTime.SetTimeZone to +1 solve the issue but these make user need to adjust time by him self i just want to simpley get exact PC time like its without needing for any addtional adjustment Upvote 0
yes we have daylight saving and setting DateTime.SetTimeZone to +1 solve the issue but these make user need to adjust time by him self i just want to simpley get exact PC time like its without needing for any addtional adjustment
Daestrum Expert Licensed User Longtime User Sep 1, 2024 #4 I don't see that problem on my pc the time returned from Code: Copy DateTime.Time(DateTime.Now) is the same as the pc clock. Upvote 0
I don't see that problem on my pc the time returned from Code: Copy DateTime.Time(DateTime.Now) is the same as the pc clock.
H hanyelmehy Well-Known Member Licensed User Longtime User Sep 1, 2024 #5 Daestrum said: I don't see that problem on my pc the time returned from Code: Copy DateTime.Time(DateTime.Now) is the same as the pc clock. Click to expand... in my case B4X: Copy DateTime.Time(DateTime.Now) return PC Time -1h , i need to adjust DateTime.SetTimeZone to +1 Upvote 0
Daestrum said: I don't see that problem on my pc the time returned from Code: Copy DateTime.Time(DateTime.Now) is the same as the pc clock. Click to expand... in my case B4X: Copy DateTime.Time(DateTime.Now) return PC Time -1h , i need to adjust DateTime.SetTimeZone to +1
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2024 #6 What is your PC timezone? What is the output of: Code: Copy Log("offset: " & DateTime.TimeZoneOffset) Log(DateTime.Now) Log(DateTime.Time(DateTime.Now)) Upvote 0
What is your PC timezone? What is the output of: Code: Copy Log("offset: " & DateTime.TimeZoneOffset) Log(DateTime.Now) Log(DateTime.Time(DateTime.Now))
H hanyelmehy Well-Known Member Licensed User Longtime User Sep 2, 2024 #7 Erel said: What is your PC timezone? What is the output of: Code: Copy Log("offset: " & DateTime.TimeZoneOffset) Log(DateTime.Now) Log(DateTime.Time(DateTime.Now)) Click to expand... Time Zone :UTC+02.00 Note :we have now daylight saving B4X: Copy offset: 0 1725265773364 08:29 AM Upvote 0
Erel said: What is your PC timezone? What is the output of: Code: Copy Log("offset: " & DateTime.TimeZoneOffset) Log(DateTime.Now) Log(DateTime.Time(DateTime.Now)) Click to expand... Time Zone :UTC+02.00 Note :we have now daylight saving B4X: Copy offset: 0 1725265773364 08:29 AM
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2024 #8 What is the output of this: Code: Copy Dim TimeZone As JavaObject TimeZone = TimeZone.InitializeStatic("java.util.TimeZone").RunMethod("getDefault", Null) Log(TimeZone) Upvote 0
What is the output of this: Code: Copy Dim TimeZone As JavaObject TimeZone = TimeZone.InitializeStatic("java.util.TimeZone").RunMethod("getDefault", Null) Log(TimeZone)
H hanyelmehy Well-Known Member Licensed User Longtime User Sep 2, 2024 #9 Erel said: What is the output of this: Code: Copy Dim TimeZone As JavaObject TimeZone = TimeZone.InitializeStatic("java.util.TimeZone").RunMethod("getDefault", Null) Log(TimeZone) Click to expand... B4X: Copy (ZoneInfo) sun.util.calendar.ZoneInfo[id="Africa/Cairo",offset=7200000,dstSavings=0,useDaylight=false,transitions=129,lastRule=null] Upvote 0
Erel said: What is the output of this: Code: Copy Dim TimeZone As JavaObject TimeZone = TimeZone.InitializeStatic("java.util.TimeZone").RunMethod("getDefault", Null) Log(TimeZone) Click to expand... B4X: Copy (ZoneInfo) sun.util.calendar.ZoneInfo[id="Africa/Cairo",offset=7200000,dstSavings=0,useDaylight=false,transitions=129,lastRule=null]
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2024 #10 Are you sure that you are NOT calling DateTime.SetTimeZone somewhere? The offset should be 2 hours. Upvote 0
teddybear Well-Known Member Licensed User Sep 2, 2024 #11 JDK needs to be upgraded. it works on jdk17, jdk21 also works Last edited: Sep 2, 2024 Upvote 0
H hanyelmehy Well-Known Member Licensed User Longtime User Sep 2, 2024 #12 Erel said: Are you sure that you are NOT calling DateTime.SetTimeZone somewhere? The offset should be 2 hours. Click to expand... sorry ,when do test i forget to remove DateTime.SetTimeZone ,offset: value is 2 i think the issue that (useDaylight=false) ,when its actually on PC is true Upvote 0
Erel said: Are you sure that you are NOT calling DateTime.SetTimeZone somewhere? The offset should be 2 hours. Click to expand... sorry ,when do test i forget to remove DateTime.SetTimeZone ,offset: value is 2 i think the issue that (useDaylight=false) ,when its actually on PC is true
Erel B4X founder Staff member Licensed User Longtime User Sep 3, 2024 #13 1. Update to OpenJdk 19. 2. The daylight offset is not related to the OS settings. The JVM includes a database with the time zones and the daylight offsets. Upvote 0
1. Update to OpenJdk 19. 2. The daylight offset is not related to the OS settings. The JVM includes a database with the time zones and the daylight offsets.