[英]Convert date time to format “dd.MM.yyyy” from another time zone to +2
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 到时区UTC + 02:00的 “ dd.MM.yyyy
”
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. 顺便说一句, UTC+02:00
它不是时区的名称,实时将取决于国家和夏令时规则。
Try this way 试试这种方式
TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "New Zealand Standard Time", "UTC")
More discussions : 更多讨论:
How to convert DateTime in Specific timezone? 如何在特定时区转换DateTime?
http://blog.mozilla.org/it/2012/11/16/converting-timezone-specific-times-in-mysql/ http://blog.mozilla.org/it/2012/11/16/converting-timezone-specific-times-in-mysql/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.