Time zones and dates

  • Thread starter Thread starter Mark Rae
  • Start date Start date
M

Mark Rae

Hi,

I'm busy implementing a PayPal solution at the moment, part of which
involves adding the PayPal transaction information to SQL Server for
fulfillment, stock management etc. PayPal provides an internal mechanism for
this, but supplies the date and time of the transaction in the following
format:

18:30:30 Jan 1, 2000 PST

Easy enough, of course, to strip off the Pacific Standard Time identifier
and convert the resulting string into a DateTime variable with
DateTime.Parse.

However, I'm in the UK, so need to record this information in UK time.

Again, easy enough to take the resulting DateTime and apply .AddHours(8) to
it, but this may not always be 100% accurate due to Daylight Savings in the
US and/or British Summer Time in the UK.

Is there anything in the Framework (customer is still on v1.1) which will
handle this, or would I need to maintain some sort of date lookup table
indicating when the time changes in the US and the UK?

Any assistance gratefully received.

Mark
 
Mark,

Unfortunately, you will have to do this yourself, as you said, based on
the time zone indicator. .NET doesn't have a good story for this, I am
afraid.

Hope this helps.
 
Unfortunately, you will have to do this yourself, as you said, based on
the time zone indicator. .NET doesn't have a good story for this, I am
afraid.

I had a feeling that this was the case...

I've had a bit a trawl round Google and the "usual" code sites, and there
isn't really anything out there, which is slightly surprising, as someone
must have encountered this situation before now...

I've posted a message on PayPal's own developer forum, because PayPal
themselves report the time of the transaction correctly in their payment
notification emails. That is, no matter where the seller and buyer are in
the world, they both receive payment notification emails showing the correct
time of the transaction in their respective time zones...
 
You might want to check out:

World Clock and the TimeZoneInformation class
http://www.codeproject.com/dotnet/WorldClock.asp

Thanks very much for that - looks pretty good. As far as I can tell, the US
& the UK change their time pretty much on the same day each year, but that
looks set to change in the US when daylight savings is scheduled to run from
March till November due to some new law...
 
Thanks very much for that - looks pretty good.

Unfortunately, on closer inspection, it doesn't get me any further forward
at all - there's even a comment in the code saying that the results might be
false due to daylight savings...
 
this, but supplies the date and time of the transaction in the following
format:
18:30:30 Jan 1, 2000 PST

I find it hard to believe that they are doing so, they should be using an
ISO8601 format and probably are. What sort of form does the data come in?
(Email, FTP, etc.)
 
Back
Top