View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Is there a way to auto convert a time stamps to Eastern Standa

On Thu, 31 Jul 2008 00:31:24 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

It has been a long, long time since I worked out the original details behind
the base code for the following, but, as I remember it, I believe the
following will do what you want (convert a user's local time to the time on
the East Coast of the US and I'm pretty sure it takes Daylight Savings Time
into account). Copy/paste the code following my signature into a Module. To
use it, you would simply call the EastCoastTime function (without
parameters) and it should work automatically. For example, this macro should
convert the current user's date/time into the date/time on the East Coast of
the US and then assign it to the selected cell...


Nice routine, Rick.

A few comments:

1. Your routine apparently cannot be just pasted below an existing sub. If I
do that, I get an error message about what cannot be allowed after end sub.

It needs to be at the top, or probably in a different module.

2. Examining the TIME_ZONE_INFORMATION value, it seems to me that this
conversion to East Coast time will only work if both locale's have the same
daylight savings time bias. It seems as if DaylightDate and StandardDate
contain the month/day/hour of conversion from one to the other.

I can see this being an issue if one wanted to convert to UTC.
--ron