correct time/date format for a users locale
Posted: July 30th, 2013, 12:32 pm
as time formats like %#c or %#x do not work for non-English users (or maybe more specifically non-US users, or maybe for nobody), one can also read those formats from the registry and use substitute to convert them to a format Rainmeter can use.
like this:
note: this is only about the format, it does not translate. but if you use this the requests for "i want AM/PM", "i want military time", etc. should drop.
like this:
Code: Select all
[Rainmeter]
Update=1000
BackgroundMode=1
[MeasureLongDate]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\International
RegValue=sLongDate
UpdateDivider=-1
RegExpSubstitute=1
Substitute="\bM\b":"%#mk","\bMM\b":"%mk","\bMMM\b":"%bk","\bMMMM\b":"%Bk","\bd\b":"%#dk","\bdd\b":"%dk","\bddd\b":"%ak","\bdddd\b":"%Ak","\byy\b":"%yk","\byyyy\b":"%Yk","k":""
[MeasureShortDate]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\International
RegValue=sShortDate
UpdateDivider=-1
RegExpSubstitute=1
Substitute="\bM\b":"%#mk","\bMM\b":"%mk","\bMMM\b":"%bk","\bMMMM\b":"%Bk","\bd\b":"%#dk","\bdd\b":"%dk","\bddd\b":"%ak","\bdddd\b":"%Ak","\byy\b":"%yk","\byyyy\b":"%Yk","k":""
[MeasureTimeFormat]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\International
RegValue=sTimeFormat
UpdateDivider=-1
RegExpSubstitute=1
Substitute="\bh\b":"%#Ik","\bhh\b":"%Ik","\bH\b":"%#Hk","\bHH\b":"%Hk","\bm\b":"%#Mk","\bmm\b":"%Mk","\bs\b":"%#Sk","\bss\b":"%Sk","\bt\b":"%pk","\btt\b":"%pk","k":""
[MeasureShortTime]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\International
RegValue=sShortTime
UpdateDivider=-1
RegExpSubstitute=1
Substitute="\bh\b":"%#Ik","\bhh\b":"%Ik","\bH\b":"%#Hk","\bHH\b":"%Hk","\bm\b":"%#Mk","\bmm\b":"%Mk","\bs\b":"%#Sk","\bss\b":"%Sk","\bt\b":"%pk","\btt\b":"%pk","k":""
[MeasureTime]
Measure=Time
Format=%#c
[MeasureTime2]
Measure=Time
Format=[MeasureLongDate] [MeasureTimeFormat]
DynamicVariables=1
[Meterb]
Meter=String
Text="Rainmeter: [MeasureTime]#CRLF#Correct: [MeasureTime2]"
X=0
Y=0
SolidColor=ffffff
DynamicVariables=1