
Code: Select all
#MinutesPerHour=60
Select GetTimeZoneInformation_(Tz.Time_zone_information)
Case #TIME_ZONE_ID_INVALID
Debug "TIME_ZONE_ID_INVALID"
End
Case #TIME_ZONE_ID_UNKNOWN
Debug "TIME_ZONE_ID_UNKNOWN"
End
Case #TIME_ZONE_ID_STANDARD
Debug "TIME_ZONE_ID_STANDARD"
Offset=(Tz\Bias+Tz\StandardBias) ; add bias's to get total minutes offset
Case #TIME_ZONE_ID_DAYLIGHT
Debug "TIME_ZONE_ID_DAYLIGHT"
Offset=(Tz\Bias+Tz\DaylightBias)
EndSelect
Debug "////////////////////////////////////////////////////////////////////"
With Tz ;display the individual items of the Time_zone_information structure
Debug "Bias in minutes = "+Str(\Bias )
Debug "////////////////////////////////////////////////////////////////////"
For a=0 To 31
StandardName$+Chr(\StandardName[a])
Next
Debug "StandardName = "+StandardName$
Debug "StandardDate - i.e. revert from daylight time"
Debug "Year should be 0 = "+Str(\StandardDate\wYear)
Debug "Day of week this will happen - 0 for sunday to 6 for saturday = "+Str(\StandardDate\wDayOfWeek)
Debug "which week to initiate as 1 to 5. e.g. 1st or last week in month = "+Str(\StandardDate\wDay )
Debug "Month in which to revert to standard time = "+Str(\StandardDate\wMonth )
StdRevert$=RSet(Str(\StandardDate\wHour),2,"0")+":"+RSet(Str(\StandardDate\wMinute),2,"0")+":"+RSet(Str(\StandardDate\wSecond),2,"0")
Debug "Time at which Standard time reverts = "+StdRevert$
Debug "Extra Bias used in standard beyond 1st Bias setting = "+Str(\StandardBias)
Debug "////////////////////////////////////////////////////////////////////"
For a=0 To 31
DaylightName$+Chr(\DaylightName[a])
Next
Debug "DaylightName = "+DaylightName$
Debug "DaylightDate - i.e. Start Daylight time"
Debug "Year should be 0 = "+Str(\DaylightDate\wYear)
Debug "Day of week this will happen - 0 for sunday to 6 for saturday = "+Str(\DaylightDate\wDayOfWeek)
Debug "which week to initiate as 1 to 5. e.g. 1st or last week in month = "+Str(\DaylightDate\wDay)
Debug "Month in which to switch to daylight time = "+Str(\DaylightDate\wMonth)
DaylightSet$=RSet(Str(\DaylightDate\wHour),2,"0")+":"+RSet(Str(\DaylightDate\wMinute),2,"0")+":"+RSet(Str(\DaylightDate\wSecond),2,"0")
Debug "Time at which Daylight time begins = "+DaylightSet$
Debug "Daylight Bias in minutes = "+Str(\DaylightBias)
Debug "////////////////////////////////////////////////////////////////////"
EndWith
Debug "Current offset = "+Str(offset)+" Minutes"
Debug "Current offset as Hours = "+StrF(offset/#MinutesPerHour,2)+" Hours"
Debug "////////////////////////////////////////////////////////////////////"
lclTime=Date() ;local computer time
utcTime=AddDate(lclTime,#PB_Date_Minute,offset) ;utc time from local time
rtnLcltime=AddDate(utcTime,#PB_Date_Minute,-offset) ;local time again, this time using utc as base
Debug "Local computers current time = "+FormatDate("%hh:%ii:%ss - %dd/%mm/%yyyy",lclTime)
Debug "based on localtime, UTC time is "+FormatDate("%hh:%ii:%ss - %dd/%mm/%yyyy",utcTime)
Debug "Local time from previous UTC call "+FormatDate("%hh:%ii:%ss - %dd/%mm/%yyyy",rtnLclTime)
Debug "////////////////////////////////////////////////////////////////////"
Debug ""
; Additional info pasted directly from MSDN
;
; Bias
; The current bias For local time translation on this computer, in minutes.
; The bias is the difference, in minutes, between Coordinated Universal
; Time (UTC) And local time. All translations between UTC And local time are
; based on the following formula:
;
; UTC = local time + bias
;
; This member is required.
;
; StandardName
; A description For standard time. For example, "EST" could indicate
; Eastern Standard Time. The string will be returned unchanged by the
; GetTimeZoneInformation function. This string can be empty.
;
; StandardDate
; A SYSTEMTIME Structure that contains a date And local time when the transition
; from daylight saving time To standard time occurs on this operating system.
; If the time zone does Not support daylight saving time Or If the caller needs
; To disable daylight saving time, the wMonth member in the SYSTEMTIME Structure
; must be zero. If this date is specified, the DaylightDate member of this Structure
; must also be specified. Otherwise, the system assumes the time zone Data is invalid
; And no changes will be applied.
;
; To Select the correct day in the month, set the wYear member To zero, the wHour
; And wMinute members To the transition time, the wDayOfWeek member To the
; appropriate weekday, And the wDay member To indicate the occurrence of the day
; of the week within the Month (1 To 5, where 5 indicates the final occurrence
; during the month If that day of the week does Not occur 5 times).
;
; Using this notation, specify 02:00 on the first Sunday in April As follows:
; wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 02:00 on the last
; Thursday in October As follows: wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5.
;
; If the wYear member is Not zero, the transition date is absolute; it will only
; occur one time. Otherwise, it is a relative date that occurs yearly.
;
; StandardBias
; The bias value To be used during local time translations that occur during standard
; time. This member is ignored If a value For the StandardDate member is Not supplied.
;
; This value is added To the value of the Bias member To form the bias used during
; standard time. In most time zones, the value of this member is zero.
;
; DaylightName
; A description For daylight saving time. For example, "PDT" could indicate Pacific
; Daylight Time. The string will be returned unchanged by the GetTimeZoneInformation
; function. This string can be empty.
;
; DaylightDate
; A SYSTEMTIME Structure that contains a date And local time when the transition
; from standard time To daylight saving time occurs on this operating system.
; If the time zone does Not support daylight saving time Or If the caller needs
; To disable daylight saving time, the wMonth member in the SYSTEMTIME Structure
; must be zero. If this date is specified, the StandardDate member in this Structure
; must also be specified. Otherwise, the system assumes the time zone Data is invalid
; And no changes will be applied.
;
; To Select the correct day in the month, set the wYear member To zero,
; the wHour And wMinute members To the transition time, the wDayOfWeek member
; To the appropriate weekday, And the wDay member To indicate the occurrence of
; the day of the week within the Month (1 To 5, where 5 indicates the final
; occurrence during the month If that day of the week does Not occur 5 times).
;
; If the wYear member is Not zero, the transition date is absolute; it will only
; occur one time. Otherwise, it is a relative date that occurs yearly.
;
; DaylightBias
; The bias value To be used during local time translations that occur during daylight
; saving time. This member is ignored If a value For the DaylightDate member is Not
; supplied.
;
; This value is added To the value of the Bias member To form the bias used during
; daylight saving time. In most time zones, the value of this member is –60.