It is currently March 29th, 2024, 4:41 am

Weekday as a number?

Get help with creating, editing & fixing problems with skins
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Weekday as a number?

Post by deXxterlab97 »

I am looking a way to make weekday as a number to use with my bar
The bar gets filled in as the week progress
Monday is where the bar is empty, sunday is when it is full

%a only shows weekday as a name. What do I do? Thanks

As you know I am new to rainmeter (another post already)

Sample of the bar

Code: Select all

[Bar Background]
Meter=Image
X=-15
Y=30
H=3
W=285
SolidColor=255,255,255,60

[MeterBar]
Meter=BAR
MeasureName=MeasureSec
X=-15
Y=30
H=3
W=285
BarColor=255,255,255,240
BarOrientation=Horizontal
deXxterlab97
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Weekday as a number?

Post by CyberTheWorm »

Try reading this, should have all the answers https://docs.rainmeter.net/manual-beta/measures/time/
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weekday as a number?

Post by balala »

deXxterlab97 wrote:I am looking a way to make weekday as a number to use with my bar
The bar gets filled in as the week progress
Monday is where the bar is empty, sunday is when it is full

%a only shows weekday as a name. What do I do? Thanks
To be a bit more precise than CyberTheWorm, I'd say that if you take a look at the Format codes, you can see there're two formats 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)
If you want to get the bar empty on Monday and filled up on Sunday, use the following measure:

Code: Select all

[MeasureWeekDay]
Measure=Time
Format=%u
MinValue=1
MaxValue=7
In plus, I recommend to take into account my last posted tips.
TrueFaith
Posts: 19
Joined: November 28th, 2016, 7:28 am

Re: Weekday as a number?

Post by TrueFaith »

didnt found in format codes a value that returns me state of week (is it odd or even), is there any?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weekday as a number?

Post by balala »

TrueFaith wrote:didnt found in format codes a value that returns me state of week (is it odd or even), is there any?
The %U, respectively the %W formats return the week of year as a number, the first one with the first Sunday as first day of week one, while the second one with first Monday as first day of week one:
%U: Week of year number, with the first Sunday as first day of week one. (00 - 53)
...
◦%W: Week of year as number, with first Monday as first day of week one. (00 - 53)
Then, to check if the week is odd or even, you can use a proper Calc measure:

Code: Select all

[MeasureWeek]
Measure=Time
Format=%W

[MeasureOddEven]
Measure=Calc
Formula=( MeasureWeek % 2 )
The [MeasureOddEven] measure will return 0 for odd weeks and 1 for even weeks.