It is currently April 25th, 2024, 8:32 am

Weekday Code u vs. Code w

Get help with installing and using Rainmeter.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Weekday Code u vs. Code w

Post by ikarus1969 »

Hello everybody,

maybe i have forgotten how to work around this but i get the same code for a weekday for both format-codes w and u.
The first should be the number of the weekday as number starting with sunday as the first day in week (with a range 0 to 6), the second one should be the weekday as number starting with monday (ISO8601; with a range from 1 to 7).

For me, both codes tell me it's weekday number 5, which can't be. Does anyone know why or what's wrong with the code?
Screenshot.png

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=004080FF

[Variables]


[Measure_Weekday_Name]
Measure=TIME
Format=%A
FormatLocale=local

[Measure_Weekday_u]
Measure=TIME
Format=%u

[Measure_Weekday_w]
Measure=TIME
Format=%w

[MeterPrice]
Meter=STRING
MeasureName=Measure_Weekday_Name
MeasureName2=Measure_Weekday_u
MeasureName3=Measure_Weekday_w
Text="%1#CRLF#Weekday u=%2#CRLF#Weekday w=%3"
X=#WORKAREAX#
Y=#WORKAREAY#
FontSize=24
FontColor=FFFFFFFF
Padding=30,20,30,20
AntiAlias=1
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 2681
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Weekday Code u vs. Code w

Post by Brian »

I think these will always be the same for Monday through Saturday, with Sunday being the only difference.

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019#generic-text-routine-mappings

%u: ISO 8601 weekday as number with Monday as 1 (1-7):

Code: Select all

1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
7 - Sunday
%w: Weekday as a decimal number with Sunday as 0 (0-6):

Code: Select all

0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
-Brian
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Weekday Code u vs. Code w

Post by ikarus1969 »

That would make sense - thank you Brian!