I want to convert this format:
2012-08-09T07:48:16+02:00
2012-01-17T17:49:05+01:00
2012-01-17T17:49:05-05:00
to "dd.MM.yyyy
" in time zone UTC+02:00
I want to convert this format:
2012-08-09T07:48:16+02:00
2012-01-17T17:49:05+01:00
2012-01-17T17:49:05-05:00
to "dd.MM.yyyy
" in time zone UTC+02:00
Check this way:
var dt = DateTime.Parse("2012-08-09T07:48:16+02:00");
var newDt = TimeZoneInfo.ConvertTime(dt, TimeZoneInfo.FindSystemTimeZoneById("FLE Standard Time"));
Console.WriteLine(newDt.ToString("dd.MM.yyyy"));
By the way, UTC+02:00
it's not name of timezone, real time will depend on country and daylight saving rules.
Try this way
TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "New Zealand Standard Time", "UTC")
More discussions :
How to convert DateTime in Specific timezone?
http://blog.mozilla.org/it/2012/11/16/converting-timezone-specific-times-in-mysql/