如何转换PDT时间字符串日期时间 [英] How to Convert PDT Time string to DateTime

查看:122
本文介绍了如何转换PDT时间字符串日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在字符串格式
22时48分32秒2011年7月29日PDT
中的数据现在我想将其转换成日期时间。
我该怎么办呢

解决方案

您是此方法后,大概是:
DateTime.Parse(串)



PDT是-7从GMT,所以你可以参考GMT和减去7小时。

  DateTime的日期时间=日期时间。解析(2011年7月29日22时48分32秒GMT); //通知GMT 
日期时间= datetime.AddHours(-7); //减去7小时


I have the data in string format "22:48:32 Jul 29, 2011 PDT" Now I want to convert it into datetime. How can I do it.

解决方案

You are probably after this method: DateTime.Parse(string)

PDT is -7 from GMT, so you can refer to the GMT and subtract 7 hours.

DateTime datetime = DateTime.Parse("Jul 29 2011 22:48:32 GMT"); // notice GMT
datetime = datetime.AddHours(-7); // minus 7 hours

这篇关于如何转换PDT时间字符串日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆