0

I need to convert a timestamp from possibly a different timezone into my local timezone. I was hoping to use c#'s

TimeZoneInfo.ConvertTime(timestamp, TimeZoneInfo.FindSystemTimeZoneById(timeZoneId), TimeZoneInfo.Local);

However, the timezone id that accompanies timestamp is something like EST5EDT, which TimeZoneInfo.FindSystemTimeZoneById() does not seem to recognize. EST5EDT appears to be a standard id, thus I would think there would be some existing code to handle such identifiers. It seems Java natively supports this type of id's (in fact, the source of the id is indeed a Java program).

Is there a c# function that converts from timezone id's such as EST5EDT to a .net TimeZoneInfo, or is there a better function than TimeZoneInfo.ConvertTime() that I could use that would recognize EST5EDT?

Jimmy
  • 5,131
  • 9
  • 55
  • 81
  • possible duplicate of [How to translate between Windows and IANA time zones?](http://stackoverflow.com/questions/17348807/how-to-translate-between-windows-and-iana-time-zones) – Matt Johnson-Pint Jul 16 '14 at 15:40
  • 1
    Also, recognize that `"EST5EDT"` is a *POSIX* style identifier. It is also one of the few that are supported for backwards compatibility, but it is essentially treated as `"America/New_York"` when you translate. If you have other more complex POSIX time zone ids, such as `"CET-1CEST,M3.5.0/2,M10.5.0/3"`, then the answer I linked will not help you. Read more in [the timezone tag wiki](http://stackoverflow.com/tags/timezone/info). – Matt Johnson-Pint Jul 16 '14 at 15:45
  • @MattJohnson Thanks for linking to your answer. I agree this is a duplicate and should be closed (which I apparently cannot do myself). – Jimmy Jul 16 '14 at 19:41

0 Answers0