It is currently April 24th, 2024, 7:59 am

String to Number?

Get help with creating, editing & fixing problems with skins
User avatar
GTI.H
Posts: 75
Joined: December 15th, 2018, 3:35 am

Re: String to Number?

Post by GTI.H »

SilverAzide wrote: December 16th, 2018, 5:03 pm I have not really followed along with this thread, but here is a public service announcement for anyone who cares: weather.com's sunrise/sunset values in the forecast sections are bogus. They are just today's values repeated for each day. The only correct sunrise/sunset values in their feed are the values for today.
Well, I suspected the sunrise/sunset values for the next days, but since no one had said so far, what you said, I had believed in values.
SilverAzide wrote: December 16th, 2018, 5:03 pm So, for the OP, you can easily calc today's day length from the weather.com feed, but for the proper calc of night length, you need tomorrow's sunrise value, and the weather.com value for this is not correct. If you don't mind the length being slightly off, of course you can calculate the night length as being simply 24 hours - day length. If you want day/night lengths and times calculated into the future (i.e., beyond today), the only way to do this properly is with some extremely complicated Lua scripting. There are skins that do this, or that can be somewhat easily modified to do this.
As I said in previous post, this works somewhat false and inelegant.
And the 24h? Are they constant?
Last edited by GTI.H on December 23rd, 2018, 9:02 pm, edited 1 time in total.
User avatar
GTI.H
Posts: 75
Joined: December 15th, 2018, 3:35 am

Re: String to Number?

Post by GTI.H »

jsmorley wrote: December 16th, 2018, 5:07 pm There is no calculation using Time measure values that will transverse days, unless you use a full date/time as the input string.

If you use 7PM and 3AM in Time measures and calculate the difference, both will be assumed to be "today". It is 16 hours from 7PM today back to 3AM today, but 8 hours from 7PM today forward to 3AM tomorrow.
Okay, I got it, thank you. :thumbup:

And what would the midnight look like?
00:00 AM | 00:00 PM
or
00:00:00 | 23:59:59
?

Come to think of it, so far I think the best solution is this one we already have:
GTI.H wrote: December 16th, 2018, 2:27 pm Surely you did not understand because if you had understood you would solve in fractions of seconds!

I was able to make it work with this code here:

Code: Select all

[MSSunDeclinationDayDuration]
Group=WPCActualTodayData | FormatSunRSTimestamp
Measure=Uptime
SecondsValue=([MSSunSTimestamp:timestamp] - [MSSunRTimestamp:timestamp])
Format=%3!i!h %2!02i!m
UpdateDivider=-1
DynamicVariables=1
Disabled=1

[MSSunDeclinationNightDurationCalc]
Group=WPCActualTodayData | FormatSunRSTimestamp
Measure=Calc
Formula=(86400 - MSSunDeclinationDayDuration)
UpdateDivider=-1
DynamicVariables=1
Disabled=1

[MSSunDeclinationNightDuration]
Group=WPCActualTodayData | FormatSunRSTimestamp
Measure=Uptime
SecondsValue=[MSSunDeclinationNightDurationCalc]
Format=%3!i!h %2!02i!m
UpdateDivider=-1
DynamicVariables=1
Disabled=1
Image

If you have no better suggestion, the issue is solved.

PS. I have seen but have not read your new post yet.