**Time Zone**and

**Daylight Savings Time**information for your local computer.

At a high level, these include:

- The full current Time Zone name. Example: "Eastern Standard Time" or "Eastern DayLight Time"
- The standard offset (bias) in minutes to UTC (Coordinated Universal Time or GMT)
- The current (active / inactive / unsupported) state of Daylight Savings Time.
- The offset (bias) in minutes from Standard to Daylight Savings Time .
- The offset (bias) in minutes from the computer's standard time to the region's Standard Time .
- The date and time of the next start / end of Daylight Savings or Standard Time.
- The date and time of the start / end of Daylight Savings or Standard Time for the current year.
- The date and time of the start / end of Daylight Savings or Standard Time for any defined year.

The date and time based information, about the start and end of Daylight Savings and Standard Time, are obtained using the

**Timestamp**option of the

**Time measure**. This is to allow you to use the Format option on the Time measure to display the dates and times any way you like, or to use the numeric value of the measure to calculate time remaining before a change.

*"You need to set your clocks back an hour tomorrow!".*

The information about the Time Zone name and offset, and the current state and offsets for DayLight Savings or Standard Time are obtained by using the

**SysInfoType**option of the

**SysInfo plugin**.

Time Measure - Timestamp.

SysInfo Plugin - Time Zone Values.

Here is an example skin that demonstrates how you might use this information:

Code: Select all

```
[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2
SolidColor=20,30,40,255
SolidColor2=30,40,50,255
AccurateText=1
[Metadata]
Name=TimeZone
Author=JSMorley
Information=Demonstration of the new Time Zone / Daylight Savings Time functionality in Rainmeter 3.2.0 r2360.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=Feb 8, 2015
; Measures
[MeasureNow]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M:%S %p
[MeasureYear]
Measure=Time
Format=%Y
[MeasureTimeZoneISDST]
Measure=Plugin
Plugin=SysInfo
SysInfoType=TIMEZONE_ISDST
UpdateDivider=60
IfCondition=MeasureTimeZoneISDST = 1
IfTrueAction=[!SetOption MeterTimeZone MeasureName "MeasureTimeZoneDaylightName"][!SetOption MeterDSTNextChange Text "Daylight Savings Time will end#CRLF#[*MeasureDSTNextEnd*]"]
IfCondition2=MeasureTimeZoneISDST = 0
IfTrueAction2=[!SetOption MeterTimeZone MeasureName "MeasureTimeZoneStandardName"][!SetOption MeterDSTNextChange Text "Daylight Savings Time will start#CRLF#[*MeasureDSTNextStart*]"]
IfCondition3=MeasureTimeZoneISDST = -1
IfTrueAction3=[!SetOption MeterTimeZone MeasureName "MeasureTimeZoneStandardName"][!HideMeterGroup TimeZone]
OnChangeAction=[!UpdateMeasureGroup TimeZone][!UpdateMeter *][!Redraw]
[MeasureTimeZoneBias]
Measure=Plugin
Plugin=SysInfo
Group=TimeZone
SysInfoType=TIMEZONE_BIAS
UpdateDivider=-1
[MeasureDSTStandardBias]
Measure=Plugin
Plugin=SysInfo
Group=TimeZone
SysInfoType=TIMEZONE_STANDARD_BIAS
UpdateDivider=-1
[MeasureDSTDaylightBias]
Measure=Plugin
Plugin=SysInfo
Group=TimeZone
SysInfoType=TIMEZONE_DAYLIGHT_BIAS
UpdateDivider=-1
[MeasureDSTCurrentBias]
Measure=Calc
Group=TimeZone
Formula=MeasureTimeZoneISDST = 1 ? MeasureDSTDaylightBias : MeasureDSTStandardBias
UpdateDivider=-1
[MeasureCalcBiasHours]
Measure=Calc
Group=TimeZone
Formula=0-(trunc((MeasureTimeZoneBias - MeasureDSTCurrentBias) / 60))
RegExpSubstitute=1
Substitute="^([\d]{1,2})$":"+\1"
UpdateDivider=-1
[MeasureCalcBiasMinutes]
Measure=Calc
Group=TimeZone
Formula=Abs(60 * (frac(MeasureTimeZoneBias / 60)))
RegExpSubstitute=1
Substitute="^(\d)$":"\10"
UpdateDivider=-1
[MeasureTimeZoneStandardName]
Measure=Plugin
Plugin=SysInfo
Group=TimeZone
SysInfoType=TIMEZONE_STANDARD_NAME
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(.*)$":"\1 [UTC [MeasureCalcBiasHours]:[MeasureCalcBiasMinutes]]"
DynamicVariables=1
[MeasureTimeZoneDaylightName]
Measure=Plugin
Plugin=SysInfo
Group=TimeZone
SysInfoType=TIMEZONE_DAYLIGHT_NAME
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(.*)$":"\1 [UTC [MeasureCalcBiasHours]:[MeasureCalcBiasMinutes]]"
DynamicVariables=1
[MeasureDSTStartThisYear]
Measure=Time
Group=TimeZone
TimeStamp=DSTStart
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
[MeasureDSTEndThisYear]
Measure=Time
Group=TimeZone
TimeStamp=DSTEnd
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
[MeasureDSTStartNextYear]
Measure=Time
Group=TimeZone
TimeStamp=DSTStart([MeasureYear]+1)
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
[MeasureDSTEndNextYear]
Measure=Time
Group=TimeZone
TimeStamp=DSTEnd([MeasureYear]+1)
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
[MeasureDSTNextStart]
Measure=Time
Group=TimeZone
TimeStamp=DSTNextStart
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
[MeasureDSTNextEnd]
Measure=Time
Group=TimeZone
TimeStamp=DSTNextEnd
Format=%A, %B %#d, %Y at %#I:%M:%S %p
UpdateDivider=-1
; Meters
[MeterNow]
Meter=String
MeasureName=MeasureNow
X=0
Y=0
FontSize=12
FontColor=230,240,250,255
Padding=10,10,0,0
AntiAlias=1
[MeterTimeZone]
Meter=String
X=0
Y=10R
FontSize=11
FontColor=230,240,250,255
Padding=10,0,10,0
AntiAlias=1
[MeterDSTNextChange]
Meter=String
Group=TimeZone
X=0
Y=10R
FontSize=11
FontColor=230,240,250,255
Padding=10,0,10,0
AntiAlias=1
[MeterDSTThisYear]
Meter=String
Group=TimeZone
MeasureName=MeasureDSTStartThisYear
MeasureName2=MeasureDSTEndThisYear
X=0
Y=10R
FontSize=11
FontColor=230,240,250,255
Padding=10,0,10,0
AntiAlias=1
Text=This year's Daylight Savings Time changes:#CRLF#Start %1#CRLF#End %2
[MeterDSTNext]
Meter=String
Group=TimeZone
MeasureName=MeasureDSTStartNextYear
MeasureName2=MeasureDSTEndNextYear
X=0
Y=10R
FontSize=11
FontColor=230,240,250,255
Padding=10,0,10,10
AntiAlias=1
Text=Next year's Daylight Savings Time changes:#CRLF#Start %1#CRLF#End %2
```

**A few notes about using this information.**All of them are demonstrated in my example skin:

**1)**For any region that supports Daylight Savings Time, the actual "difference" between the local time and UTC will be determined by both the standard bias from UTC and any DayLight Savings Time bias currently in effect. For instance in the U.S. "Eastern" Time Zone, the offset is 5 hours during Standard Time and 4 hours during Daylight Savings Time. So the formulas you always want to use are:

UTC = local standard time + local standard bias + standard or daylight savings bias

local standard time = UTC - local standard bias - standard or daylight savings bias

**2)**The bias in minutes to UTC returned for your time zone is the time

**from**your time

**to**UTC time. What this means is that for example if you live in the Eastern Standard Time zone, the number returned will be a positive number of minutes, 300. (5 hours) If you want to use or display this information as the time

**from**UTC

**to**your local time, or in this case (UTC-5:00) as you might often see it, You will need to reverse the "sign" of the number. Ways to do that are by simply multiplying the number by -1 (bias * -1), or just subtracting the result of your formula from zero.

bias = 300

(bias * -1) = -300

(0 - bias) = -300

This is also true for the bias in minutes from Daylight Savings Time

**to**Standard Time. That will almost universally be -60. In order to use it as Standard Time

**to**Daylight Savings Time, you might use the same (bias * -1) approach to reverse the "sign" of this number. However, logically you really don't want to reverse it, but just make it positive. It will always be negative. You can do that by simply using the Abs() (Absolute Value) function on the number. Absolute Value is simply the "distance" from zero to your number, and is always positive.

bias = -60

Abs(bias) = 60

**3)**The bias in minutes from your local standard time to UTC may well not divide to an even number of "hours". Some regions have time zones that are "some hours and 30 minutes" or even "some hours and 45 minutes" from UTC. There are two mathematical functions that can help you with this, as simply dividing by 60 won't return "Hours.Minutes", but "Hours.FractionOfAnHour".

Dividing 330 by 60 will return 5.5. That's fine, do that.

Then what you can do is use Trunc() to get just the first "5", the "hours". Then use Frac() to get the ".5" fractional part of the number. You can then calculate and apply the percent of "60 minutes" that ".5 of an hour" is. Half an hour is 30 minutes, or (60 * .5).

Then display those two numbers with a ":" between them, and you have the time in hours and minutes (5:30).

**4)**You should always determine the "state" (active / inactive / unsupported) of Daylight Savings Time before using any of the functionality related to getting the times / dates for changes or the current Daylight Savings or Standard bias information. Once you know if Daylight Savings Time is active or not, you can use !SetOption and other methods ensure you obtain the correct information for the time of year, or just disable / hide things you won't need.

**5)**Quite a few regions don't support Daylight Savings Time at all. For those, the "state" returned will be -1 or "unsupported". In that case, while you can certainly still get and display Time Zone and bias to UTC information, no valid Daylight Savings Time date / time information will be available, and all Daylight Savings Time / Standard Time bias values will be zero.