ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Calculating world time shifts (https://www.excelbanter.com/excel-discussion-misc-queries/160306-calculating-world-time-shifts.html)

Bill Ridgeway

Calculating world time shifts
 
I would like a formula to return GMT for places around the world. Obviously
some places will be in advance of GMT and some behind GMT. The difficulty I
have found is in dealing with time that go either into the previous or
following day.

Any help please?

Thanks.

Bill Ridgeway



Gary''s Student

Calculating world time shifts
 
How about:

Function gmt() As Date
Application.Volatile
dot = "."
Set Serve = GetObject("winmgmts:\\" & dot & "\root\cimv2")
Set Zones = Serve.ExecQuery("Select * From Win32_TimeZone")

For Each Zone In Zones
intTimeZoneBias = Zone.Bias
intDayLightBias = Zone.DaylightBias
Next

gmt = Now() - (intTimeZoneBias - intDayLightBias) / (60 * 24)

End Function

I think from Pearson ? It should give true GMT whatever local time is.
--
Gary''s Student - gsnu2007


"Bill Ridgeway" wrote:

I would like a formula to return GMT for places around the world. Obviously
some places will be in advance of GMT and some behind GMT. The difficulty I
have found is in dealing with time that go either into the previous or
following day.

Any help please?

Thanks.

Bill Ridgeway




Bill Ridgeway

Calculating world time shifts
 
"Bill Ridgeway" wrote in message
...
I would like a formula to return GMT for places around the world.
Obviously some places will be in advance of GMT and some behind GMT. The
difficulty I have found is in dealing with time that go either into the
previous or following day.

Any help please?

Thanks.

Bill Ridgeway


I think I've resolved this question. For anyone whose interested in the
answer -

Where -
column B is local time
column C is the + or - difference
column D is the actual shift
column E is the folrmula =IF(C3="-",B3+D3,IF(C3="+",B3+24-D3))

Regards.

Bill Ridgeway




All times are GMT +1. The time now is 02:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com