It is currently June 23rd, 2024, 11:26 pm

Measure Time %a to Number

Get help with creating, editing & fixing problems with skins
Goonomi
Posts: 4
Joined: December 9th, 2015, 4:50 pm

Measure Time %a to Number

Post by Goonomi »

Hi y'all,

i'm working on a little calendar and i found something that is driving me crazy:

Code: Select all

[Rainmeter]
Author=Goonomi

[MeasureDayOfWeek]
Measure=Time
Format=%a

[MeasureDayOfWeekNumber]
Measure=Calc
Formula=MeasureDayOfWeek="Mon" ? 0 :
        MeasureDayOfWeek="Tue" ? 1 :
        MeasureDayOfWeek="Wed" ? 2 : 
        MeasureDayOfWeek="Thu" ? 3 :
        MeasureDayOfWeek="Fri" ? 4 :
        MeasureDayOfWeek="Sat" ? 5 : 
        MeasureDayOfWeek="Sun" ? 6 :
        -1

[MeasureNextDayOfWeek]
Measure=Calc
Formula=MeasureDayOfWeekNumber+1

[MeterConsole2]
Meter=String
AntiAlias=1
Checking this .ini on the Protocoll gives me this: (i attached the picture, no idea how to link it into this text ...)
The [MeasureDayOfWeek] returns Wed but [MeasureDayOfWeekNumber] checks for "Wed" (for today) and doesnt find it.

Any help would be greatly appreciated
You do not have the required permissions to view the files attached to this post.
Last edited by Goonomi on November 1st, 2018, 9:16 am, edited 2 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Time %a to Number

Post by balala »

The Formula option of a Calc measure must be entirely numeric. String are not allowed. For such action, you have to use IfMatch options.
However in this case nor this is needed, because the Format option of Time measure has two values which return the weekday as number:
•%u: ISO 8601 weekday as number with Monday as first day of week. (1 - 7)
...
•%w: Weekday as number with Sunday as first day of week. (0 - 6)
So, if you replace the Format=%a option of the [MeasureDayOfWeek] measure with Format=%u, you'll get a number between 1 (for Monday) and 7 (for Sunday). If needed a Calc measure can be used to extract one from the above value, to get it as you need it:

Code: Select all

[MeasureDayOfWeekNumber]
Measure=Calc
Formula=( MeasureDayOfWeek - 1 )
Goonomi
Posts: 4
Joined: December 9th, 2015, 4:50 pm

Re: Measure Time %a to Number

Post by Goonomi »

So, if you replace the Format=%a option of the [MeasureDayOfWeek] measure with Format=%u, you'll get a number between 1 (for Monday) and 7 (for Sunday).
Oh, wow. So simple. Thanks a ton balala.
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Time %a to Number

Post by balala »

You're welcome.
User avatar
JonPeyton
Posts: 26
Joined: November 3rd, 2015, 1:39 am
Location: Tennessee

Re: Measure Time %a to Number

Post by JonPeyton »

Even six years later, Thank you balala ! :welcome:
EVGA Z790 Classified
INTEL i9 13900KS
RTX 4090 24GB (Gigabyte)
64GB Corsair Dominator RAM @ 6000MHz
2 Samsung 950 Pro M.2 (System/Gaming)
2 10TB Seagate 7500 RPM (Stuff)
User avatar
balala
Rainmeter Sage
Posts: 16325
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Time %a to Number

Post by balala »

JonPeyton wrote: May 22nd, 2024, 3:24 pm Even six years later, Thank you balala ! :welcome:
You're welcome from my part, If I helped.