我有这个UTC + 0日期:如何将UTC + 0日期转换为PST日期?
2011-11-28T07:21:41.000Z
,我想,在C#中,将其转换为PST日期。我该怎么做?试着用:
object.Data.ToLocalTime()
,但我不能得到正确的值(应为2011-11-26)
编辑
也试过(另一个话题suggesion后)这一点:
DateTime convertedDate = DateTime.SpecifyKind(
DateTime.Parse(object.Data.ToShortDateString()),
DateTimeKind.Utc);
DateTime dt = convertedDate.ToLocalTime();
string dataVideo = dt.ToShortDateString();
但日期仍然28/11/2011,并不是27/11/2011
检查此问题:http://stackoverflow.com/questions/179940/c-sharp-convert-utc-gmt-time-to-local-time – Nayan
尝试了一些策略,如'DateTime.Parse(object。 Data.ToShortDateString())。ToLocalTime()'但没有任何反应...... – markzzz
我没有看到失败模式,只有一个:检查你的机器实际上是否在PST时区。记录你得到的时间,而不仅仅是日期。 –