Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I display time in gmt when my system clock is set to local

I have my Amateur Radio log in Excel, and likely will be converting it to
Access. My system clock is set to Eastern Time, changing between EST and EDT.
I need my entries to display in GMT (Greenwich Mean Time), which is fixed and
does not change with DST.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I display time in gmt when my system clock is set to local

try this UDF:

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
--
Gary''s Student - gsnu200753


"ai4gk" wrote:

I have my Amateur Radio log in Excel, and likely will be converting it to
Access. My system clock is set to Eastern Time, changing between EST and EDT.
I need my entries to display in GMT (Greenwich Mean Time), which is fixed and
does not change with DST.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I display time in gmt when my system clock is set to lo

Okay. How do I plug that into the Excel sheet, and will that carry into
Access when I import it?

Thanks.

"Gary''s Student" wrote:

try this UDF:

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
--
Gary''s Student - gsnu200753


"ai4gk" wrote:

I have my Amateur Radio log in Excel, and likely will be converting it to
Access. My system clock is set to Eastern Time, changing between EST and EDT.
I need my entries to display in GMT (Greenwich Mean Time), which is fixed and
does not change with DST.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I display time in gmt when my system clock is set to lo


User Defined Functions (UDFs) are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use this UDF from Excel:

=gmt()

Like =SUM() or =AVERAGE(), but with no arguments

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx
for specifics on UDFs



--
Gary''s Student - gsnu200753


"ai4gk" wrote:

Okay. How do I plug that into the Excel sheet, and will that carry into
Access when I import it?

Thanks.

"Gary''s Student" wrote:

try this UDF:

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
--
Gary''s Student - gsnu200753


"ai4gk" wrote:

I have my Amateur Radio log in Excel, and likely will be converting it to
Access. My system clock is set to Eastern Time, changing between EST and EDT.
I need my entries to display in GMT (Greenwich Mean Time), which is fixed and
does not change with DST.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating a future date using system clock & time remaining Steve Chalom[_2_] Excel Worksheet Functions 1 November 5th 09 03:11 PM
How do I enter time (12-hour clock) & have it display it? MJB_FI Excel Discussion (Misc queries) 3 September 17th 09 05:36 PM
Incremental time values based upon clock in and clock out times saltnsnails Excel Discussion (Misc queries) 8 January 13th 09 08:11 PM
Change EXCEL Clock to Standard Clock or Military Time YoMarie Excel Worksheet Functions 4 April 29th 07 08:39 PM
Reset system clock? Martin[_16_] Excel Programming 13 May 29th 04 03:08 AM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"