Dear friends,
as I saw, using the Time Input widget, the variable getTZ() keeps the selected timezone but in string like: “Europe/Athens”. Is there an easy way to convert it in time difference from UTC? (ex in case of Europe/Athens this will be UTC +3)
@Dmitriy @Costas
So what do you suggest?
It is strange that the Time Input widget does not provide timezones as a numeric displacement from UTC. Am I right @Dmitriy to this conclusion or I missed something?
Get the TimeZone library and stay on using UNIX times, it’s the only viable solution for now (that I’m aware off). The TimeZone library converts times to/from UTC/local. Once you get the hang of it, it works really well.
Ow yes, the TimeZone lib also supports (custom) DST!
Agreed, but for now I find it the most elegant solution to have Blynk do everything in UTC and I make my own times, with or without DST. Using a workaround is never a fix of course
It should be based on the clock of the phone, which will do everything correct if setup ok. It knows the location of the user and it’s timezones.
I could be wrong but I don’t think Blynk has access to phone time.
Is it a problem for you if @Dmitriy makes TimeInput work to local time rather than UTC?
Not really, I wouldn’t mind either way, but it has to be clear how it works. I do an API call to get, for example, sunrise/sunset times from a website and they are all in UTC, so for me personally it’s easier if everything is UTC. I can do my own calculations based on that (and that’s how I’ve set it up right now). The Wemos handles it fine so far
Just checking, but I convert the currentTime for measurements at only one point, so using local time from RTC widget instead of UTC saves me 1 line of code
@mikekgr@Costas could you please test this build and tell me if that what you expect? You need to select at least 1 day to make it work (server issue). startTime/endTime now in local time of selected timezone. Offset also available if needed.
Dear @Dmitriy ,
the Android app you sent us is working fine but in the Arduino sketch I can not use the new time zone offset variable (I suppose that an updated library it is mandatory). I get the folowing error:
class TimeInputParam’ has no member named 'getTZ_Offset
@Dmitriy thanks I can confirm TimeInput now gives the times as local.
Serial.println(String("Time zone offset: ") + t.getTZ_Offset()); is coming back with this error:
'class TimeInputParam' has no member named 'getTZ_Offset'
Will 0.3.9 that @vshymanskyy published earlier tonight include getTZ_Offset ?
And t.getTZ() is compiling but giving a value of zero, is this covered by 0.3.9 as well or do we need to remove the widget and set the TZ again?
It is there but Serial.println(String("Time zone: ") + t.getTZ()) gives 0 rather than the 3 I expect for Nicosia.
I have removed TimeInput widget and added in again but same result.
I assume I don’t need to remove RTC as TimeInput has it’s own TZ setting.