DST condition

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

DST condition

Post by Wibbly » 02 Apr 2019 08:14

Anyone know how to test if the phone has set itself into Daylight Savings Time?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: DST condition

Post by anuraag » 02 Apr 2019 13:45

Code: Select all

tz=callJavaStaticMethod("java.util.TimeZone", "getDefault()"); 
 //timezone
DST=callJavaMethod(tz, "java.util.TimeZone", "observesDaylightTime()"); //will give true for if DST is on

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: DST condition

Post by Wibbly » 05 Apr 2019 13:14

Thanks, will give that a try -)

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: DST condition

Post by Wibbly » 30 May 2019 12:33

Gives an error:

No method with name observes DaylightTime found in class libcore.util.ZoneInfo (Expression: callJavaMethod(tz, "java.util.TimeZone", "observesDaylightTime()")[line 2], Cause: observesDaylightTime [])

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: DST condition

Post by anuraag » 30 May 2019 14:08

Try

Code: Select all

tz=callJavaStaticMethod("java.util.TimeZone", "getDefault()"); 
 //timezone

dst=callJavaMethod(tz, "java.util.TimeZone", "inDaylightTime(java.util.Date)", callJavaConstructor("java.util.Date", "Date()")) 

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: DST condition

Post by Wibbly » 03 Jun 2019 11:59

Thanks - will see what happens when we move from DST later this month :-)

User avatar
webtrekker
Posts: 14
Joined: 30 May 2019 23:58

Re: DST condition

Post by webtrekker » 20 Jun 2019 19:32

Thanks for that anuraag. It seems to work fine for me.

Post Reply