Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If there is no funtion, does anyone know what file the time zone is stored in
for Windows? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
paste the User-Defined-Function TimeZoneInfo() in your workbook.
Call it with... =TimeZoneInfo() -Suggest you WordWrap for easy viewing with a column width of at least 35 -googled this response. 'from microsoft.public.vb.winapi 'Mar 20, 2001 4:53 pm ' contributed by Bob Butler ] '/-----------------------------------------------------------/ ' Time Zone API declarations Private Const TIME_ZONE_ID_UNKNOWN = 0 Private Const TIME_ZONE_ID_STANDARD = 1 Private Const TIME_ZONE_ID_INVALID = &HFFFFFFFF Private Const TIME_ZONE_ID_DAYLIGHT = 2 Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Type TIME_ZONE_INFORMATION bias As Long ' current offset to GMT StandardName(1 To 64) As Byte ' unicode string StandardDate As SYSTEMTIME StandardBias As Long DaylightName(1 To 64) As Byte DaylightDate As SYSTEMTIME DaylightBias As Long End Type Private Declare Function GetTimeZoneInformation Lib "kernel32" _ (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long '/-----------------------------------------------------------/ Public Function TimeZoneInfo() Dim x As Long ' scratch Dim uTZI As TIME_ZONE_INFORMATION Dim dtNow As Date ' current system time Dim dtGMT As Date ' current GMT time Dim lBias As Long ' current offset Dim sName As String ' current tz name Dim sDS As String ' Daylight Savings? Dim sInfo As String ' scratch Select Case GetTimeZoneInformation(uTZI) ' if not daylight assume standard Case TIME_ZONE_ID_DAYLIGHT sName = uTZI.DaylightName ' convert to string lBias = uTZI.bias + uTZI.DaylightBias sDS = "Daylight Savings Time is in effect" Case Else sName = uTZI.StandardName lBias = uTZI.bias + uTZI.StandardBias sDS = "Daylight Savings Time is not in effect" End Select ' name terminates with null x = InStr(sName, vbNullChar) If x 0 Then sName = Left$(sName, x - 1) End If dtNow = Now ' get time dtGMT = DateAdd("n", lBias, dtNow) ' calculate GMT ' build string to display info ' sInfo = "Time Zone: " & sName & vbCrLf & _ "Local time: " & Format$(dtNow, "dd-mmm-yyyy hh:mm:ss") & _ vbCrLf & "GMT offset: " & CStr(lBias \ 60) & " hours, " & _ CStr(lBias Mod 60) & " minutes" & vbCrLf & _ sDS & vbCrLf & "GMT time: " & _ Format$(dtGMT, "dd-mmm-yyyy hh:mm:ss") & vbCrLf sInfo = "Time Zone: " & sName & vbCrLf & _ "Local time: " & Format$(dtNow, "dd-mmm-yyyy hh:mm:ss") & _ vbCrLf & "GMT offset: " & CStr(lBias \ 60) & " hours, " & _ CStr(lBias Mod 60) & " minutes" & vbCrLf & _ sDS & vbCrLf & "GMT time: " & _ Format$(dtGMT, "dd-mmm-yyyy hh:mm:ss") & vbCrLf TimeZoneInfo = sInfo End Function '/-----------------------------------------------------------/ HTH, -- Gary Brown If this post was helpful, please click the ''Yes'' button next to ''Was this Post Helpfull to you?''. "RW" wrote: If there is no funtion, does anyone know what file the time zone is stored in for Windows? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I don't want to display any controls in excel. | Excel Discussion (Misc queries) | |||
What is the formula to display a negative time results? | Excel Worksheet Functions | |||
How do you display Greek and Russian languages in excel? | Excel Discussion (Misc queries) | |||
Imported Date & Time format with calcs. managed in excel from imrp | Excel Worksheet Functions | |||
Excel sheet for workout jogging time and graph | New Users to Excel |