views:

1192

answers:

1

Is there a way in an Excel VBA macro to get the current datetime in UTC format? I can call Now() to get the current time in the local timezone; is there a generic way to then convert this to UTC?

Thanks, Jon

+3  A: 

http://excel.tips.net/Pages/T002185%5FAutomatically%5FConverting%5Fto%5FGMT.html

There is a macro on that page with a LocalTimeToUTC method. Looks like it would do the trick. Also some formula examples if you wanted to go that route.

Edit - Another link. http://www.cpearson.com/excel/TimeZoneAndDaylightTime.aspx This page has several methods for date/time. Pick your poison. Either should do the trick, but I feel like the second is prettier. ;)

brad.huffman
Ugh, both use Windows API calls, but if that's the only way then, then so be it. Thanks.
Jon