Quick question: does the "%z" format code recognize Dayligh Saving Time?
It is currently September 10th, 2024, 11:26 pm
Time Zone Abbreviation
-
- Posts: 195
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
Re: Time Zone Abbreviation
-
- Developer
- Posts: 22727
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
-
- Posts: 195
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
-
- Posts: 195
- Joined: April 10th, 2014, 12:31 am
- Location: Canada
Re: Time Zone Abbreviation
Thanks to all who contributed to this thread.
After a lot of reading and searching, I decided to use WebParser with the following two sites, both of which were mentioned by one or another in this thread:
https://ipapi.co/json
https://api.geotimezone.com/public/timezone?latitude=38.7351&longitude=-77.0797
The lat./long. in the second URL will be filled in with the lat./long. gathered from the first URL, which uses one's IP address.
Since I'm working with a desktop, I decided to put the static information (city, lat./long., etc.) in a tooltip, rather than continuously displaying unchanging information.
So here's some sample code pulled from my suite:
This is just a work in progress, but you should be able to run it. Feel free to comment on any improvements or otherwise.
After a lot of reading and searching, I decided to use WebParser with the following two sites, both of which were mentioned by one or another in this thread:
https://ipapi.co/json
https://api.geotimezone.com/public/timezone?latitude=38.7351&longitude=-77.0797
The lat./long. in the second URL will be filled in with the lat./long. gathered from the first URL, which uses one's IP address.
Since I'm working with a desktop, I decided to put the static information (city, lat./long., etc.) in a tooltip, rather than continuously displaying unchanging information.
So here's some sample code pulled from my suite:
Code: Select all
;=======================================
; RAINMETER
;=======================================
[Rainmeter]
Update=1000
AccurateText=1
OnRefreshAction=[!Move #skinX# #skinY#]
;=======================================
; VARIABLES
;=======================================
[Variables]
; Variables from the include file.
;---------------------------------------
q3workAreaWidth=#WORKAREAWIDTH#
q3workAreaHeight=#WORKAREAHEIGHT#
q3screenBorder=4
q3skinBorder=2
q3dividerWidth=2
q3titlebarHeight=32
q3titlebarCenterY=(trunc(#q3titlebarHeight#/2))
q3titleCoverHeight=10
q3cornerRoundness=7
q3cellWidth=(Round(#q3workAreaWidth#/100)*10)
q3leftPanelX=(#WORKAREAX#+#q3screenBorder#)
q3leftPanelY=(#WORKAREAY#+#q3screenBorder#)
q3leftPanelWidth=(trunc((#q3workAreaWidth#-(#q3screenBorder#*4)-(#q3cellWidth#*7)-#q3dividerWidth#)/2))
q3leftPanelLeft=#q3leftPanelX#
q3leftPanelRight=(#q3leftPanelLeft#+#q3leftPanelWidth#-1)
q3leftPanelCenterX=(#q3leftPanelLeft#+(#q3leftPanelWidth#/2))
q3clockHeight=(#q3titlebarHeight#*2)
q3clrBackground=0,99,177,255
q3clrBorder=0,120,215,255
q3clrTitlebar=0,120,215,255
q3clrText=255,255,255,255
q3fontBold=700
; Geolocation WebParser Addresses
;---------------------------------------
; IPAPIsite: IP API site.
; GEOtimezoneSite: GEO Timezone site.
IPAPIsite=https://ipapi.co/json
GEOtimezoneSite=https://api.geotimezone.com/public/timezone?latitude=[&msrIPAPIlatitude]&longitude=[&msrIPAPIlongitude]
; Skin Variables
;---------------------------------------
; skinBorder: size of skin border.
; skinX: skin left edge position on screen.
; skinY: skin top edge position on screen.
; skinWidth: width of the skin.
; skinHeight: height of the skin.
; skinLeft: left edge of skin; always 0.
; skinRight: right edge of skin.
; skinTop: top edge of skin; always 0.
; skinBottom: bottom edge of skin.
; skinCenterX: horizontal center of skin.
skinBorder=#q3skinBorder#
skinX=#q3leftPanelX#
skinY=#q3leftPanelY#
skinWidth=#q3leftPanelWidth#
skinHeight=#q3clockHeight#
skinRight=#q3leftPanelRight#
skinBottom=(#skinY#+#skinHeight#-1)
skinCenterX=#q3leftPanelCenterX#
[styleHeader]
FontFace=Trebuchet MS
FontSize=13
FontWeight=#q3fontBold#
FontColor=#q3clrText#
StringAlign=CenterCenter
StringCase=None
AntiAlias=1
ClipString=0
;=======================================
; CLOCK MEASURES
;=======================================
;---------------------------------------
; IPAPI Site Measures
;---------------------------------------
[msrIPAPISite]
Measure=WebParser
UpdateRate=3600
URL=#IPAPIsite#
RegExp=(?siU)"ip": "(.*)".*"city": "(.*)".*"region": "(.*)".*"region_code": "(.*)".*"country_name": "(.*)".*"country_code": "(.*)".*"latitude": (.*),.*"longitude": (.*),.*"timezone": "(.*)".*"utc_offset": "(.*)"
FinishAction=[!CommandMeasure msrGEOtimezoneSite "Update"]
[msrIPAPIip]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=1
[msrIPAPIcity]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=2
[msrIPAPIregion]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=3
[msrIPAPIregion_code]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=4
[msrIPAPIcountry]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=5
[msrIPAPIcountry_code]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=6
[msrIPAPIlatitude]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=7
[msrIPAPIlongitude]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=8
[msrIPAPItimezone]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=9
[msrIPAPIutc_offset]
Measure=WebParser
URL=[msrIPAPISite]
StringIndex=10
;---------------------------------------
; GEO Timezone Site Measures
;---------------------------------------
[msrGEOtimezoneSite]
Measure=WebParser
UpdateRate=3600
DynamicVariables=1
URL=#GEOtimezoneSite#
RegExp=(?siU)"timezone_abbreviation":"(.*)".*"dst_abbreviation":"(.*)"
[msrGEOtimezoneSTDabbrev]
Measure=WebParser
URL=[msrGEOtimezoneSite]
StringIndex=1
[msrGEOtimezoneDSTabbrev]
Measure=WebParser
URL=[msrGEOtimezoneSite]
StringIndex=2
;---------------------------------------
; Generanl Clock Measures
;---------------------------------------
[msrTZStandardName]
Measure=SysInfo
SysInfoType=TIMEZONE_STANDARD_NAME
UpdateDivider=-1
[msrTZDaylightName]
Measure=SysInfo
SysInfoType=TIMEZONE_DAYLIGHT_NAME
UpdateDivider=-1
[msrTZisDaylight]
Measure=SysInfo
SysInfoType=TIMEZONE_ISDST
IfCondition=msrTZisDaylight = 1
IfTrueAction=[!SetOption mtrClockBody MeasureName2 "msrGEOtimezoneDSTabbrev"][!SetOption mtrClockBackground MeasureName11 "msrTZDaylightName"]
IfFalseAction=[!SetOption mtrClockBody MeasureName2 "msrGEOtimezoneSTDabbrev"][!SetOption mtrClockBackground MeasureName11 "msrTZStandardName"]
[msrTimeDayDate12]
Measure=Time
Format=%A, %B %d %#I:%M %p
[msrTimeDate24]
Measure=Time
Format=%Y-%m-%d %H%M.%S
;=======================================
; CLOCK METERS
;=======================================
; Display the clock background and title bar.
;=======================================
; The first shape is the background rectangle with rounded corners, the second
; shape is the title bar with rounded corners, and the third shape is a square-
; cornered rectangle to cover the title bar's bottom rounded corners.
[mtrClockBackground]
Meter=Shape
MeasureName=msrIPAPIip
MeasureName2=msrIPAPIcity
MeasureName3=msrIPAPIregion
MeasureName4=msrIPAPIregion_code
MeasureName5=msrIPAPIcountry
MeasureName6=msrIPAPIcountry_code
MeasureName7=msrIPAPIlatitude
MeasureName8=msrIPAPIlongitude
MeasureName9=msrIPAPItimezone
MeasureName10=msrIPAPIutc_offset
MeasureName11=msrTZStandardName
Shape=Rectangle 0,0,#skinWidth#,#skinHeight#,#q3cornerRoundness# | StrokeWidth #skinBorder# | Stroke Color #q3clrBorder# | Fill Color #q3clrBackground#
Shape2=Rectangle 0,0,#skinWidth#,#q3titlebarHeight#,#q3cornerRoundness# | StrokeWidth #skinBorder# | Stroke Color #q3clrTitleBar# | Fill Color #q3clrTitleBar#
Shape3=Rectangle 0,(#q3titlebarHeight#-#q3titleCoverHeight#),#skinWidth#,#q3titleCoverHeight# | StrokeWidth #skinBorder# | Stroke Color #q3clrBorder# | Fill Color #q3clrTitleBar#
DynamicVariables=1
AntiAlias=1
X=0
Y=0
W=#skinWidth#
H=#skinHeight#
ToolTipType=#QtipType#
ToolTipText="%2, %4, %5#CRLF#Latitude: %7#CRLF#longitude: %8#CRLF#%9 (%10)#CRLF#%11#CRLF#IP: %1"
; Display the clock title.
;---------------------------------------
[mtrClockTitle]
Meter=String
MeterStyle=styleHeader
MeasureName=msrTimeDayDate12
ClipString=1
X=#skinCenterX#
Y=#q3titlebarCenterY#
W=#skinWidth#
H=#q3titlebarHeight#
InlineSetting=Case | Lower
InlinePattern=AM|PM
Text="%1"
; Display the clock body.
;---------------------------------------
[mtrClockBody]
Meter=String
MeterStyle=styleHeader
MeasureName=msrTimeDate24
MeasureName2=msrGEOtimezoneSTDabbrev
MeasureName3=msrIPAPIutc_offset
DynamicVariables=1
ClipString=1
X=#skinCenterX#
Y=0R
W=#skinWidth#
H=#q3titlebarHeight#
Text="%1 %2 (%3)"
-
- Developer
- Posts: 22727
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Time Zone Abbreviation
Very nice. Good work!
-
- Posts: 195
- Joined: April 10th, 2014, 12:31 am
- Location: Canada