It is currently April 28th, 2024, 2:20 am
Display image based on sunrise / sunset measures
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
How could i calculate the time difference, between [MeasureSunset] and [MeasureSunrise] ?
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
First let's clarify something: you need the time difference between [MeasureSunset] and [MeasureSunrise], or vice-versa, between [MeasureSunrise] and [MeasureSunset]? Because last one is the length of the day, while the first (what you asked for) is the length of the night.xenium wrote:How could i calculate the time difference, between [MeasureSunset] and [MeasureSunrise] ?
Anyway, if you need the difference between [MeasureSunrise] and [MeasureSunset], it's a bit easier: you simply have to extract the numeric value of [MeasureSunrise], from the numeric value of [MeasureSunset] (keep in mind that [MeasureSunset] and [MeasureSunrise] are not numbers, so you can't extract them, but you can extract the [MeasureSunsetMoment] and [MeasureSunriseMoment], which are numbers):
Code: Select all
[MeasureDayLength]
Measure=Calc
Formula=( MeasureSunsetMoment - MeasureSunriseMoment )
Code: Select all
[MeasureNightLength]
Measure=Calc
Formula=( 1440 - MeasureSunsetMoment + MeasureSunriseMoment )
IMPORTANT: Don't forget to convert this to seconds, hours or whatever you need.
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
... and how do I convert minutes into hours and minutes ?balala wrote:First let's clarify something: you need the time difference between [MeasureSunset] and [MeasureSunrise], or vice-versa, between [MeasureSunrise] and [MeasureSunset]? Because last one is the length of the day, while the first (what you asked for) is the length of the night.
Anyway, if you need the difference between [MeasureSunrise] and [MeasureSunset], it's a bit easier: you simply have to extract the numeric value of [MeasureSunrise], from the numeric value of [MeasureSunset] (keep in mind that [MeasureSunset] and [MeasureSunrise] are not numbers, so you can't extract them, but you can extract the [MeasureSunsetMoment] and [MeasureSunriseMoment], which are numbers):On the other hand, if you need to get the length of the night, you have to calculate the length of day, then extract the got value from 1440 (number of minutes into a day):Code: Select all
[MeasureDayLength] Measure=Calc Formula=( MeasureSunsetMoment - MeasureSunriseMoment )
In both cases you'll get the result into minutes.Code: Select all
[MeasureNightLength] Measure=Calc Formula=( 1440 - MeasureSunsetMoment + MeasureSunriseMoment )
IMPORTANT: Don't forget to convert this to seconds, hours or whatever you need.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
For example with the following two Calc measures:xenium wrote:... and how do I convert minutes into hours and minutes ?
Code: Select all
[MeasureDayLengthHour]
Measure=Calc
Formula=( Floor ( MeasureDayLength / 60 ))
[MeasureDayLengthMinute]
Measure=Calc
Formula=( MeasureDayLength % 60 )
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
Many thanks !balala wrote:For example with the following two Calc measures:If needed same way you can convert the [MeasureNightLength].Code: Select all
[MeasureDayLengthHour] Measure=Calc Formula=( Floor ( MeasureDayLength / 60 )) [MeasureDayLengthMinute] Measure=Calc Formula=( MeasureDayLength % 60 )
... and I apologize for stressing you with so many questions.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
You're welcome.xenium wrote:Many thanks !
... and I apologize for stressing you with so many questions.
Don't worry, no stress at all. If you would stress me in worst case I wouldn't reply.
But finally have you got the skin working as intended?
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
Yes, it now works exactly what I wanted.balala wrote:You're welcome.
Don't worry, no stress at all. If you would stress me in worst case I wouldn't reply.
But finally have you got the skin working as intended?
I still have to do, and the AM / PM version.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
You mean you'd like to convert the Sunrise / Sunset to 12 hours format?xenium wrote:I still have to do, and the AM / PM version.
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
Yesbalala wrote:You mean you'd like to convert the Sunrise / Sunset to 12 hours format?
If change the link in the code in the first post with https://www.foreca.com/Bulgaria/Sofia?units=us&tf=12h, MeasureSunrise and MeasureSunset will display the hours in the 12 hours format.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
Yes, but in this case all measures have to be rewritten. Do you know how to do this?xenium wrote:If change the link in the code in the first post with https://www.foreca.com/Bulgaria/Sofia?units=us&tf=12h, MeasureSunrise and MeasureSunset will display the hours in the 12 hours format.