`
isiqi
  • 浏览: 16054570 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

DateTime.ParseExact的使用

阅读更多

c#中关于时间转换提供了两种方法:DateTime.ParseExact()和 Convert.ToDateTime(string),ParseExact使用起来会更加灵活,可以由用户自己来定义时间格式,比如数据库里某字段的值都是20071225这种形式,我们可以这样转换:
DateTime time1 = DateTime.ParseExact(dt,"yyyyMMdd", null);
dt为这样的字符串:"20071225

来自:http://www.cn-web.com/shtml/article/net/csharp/2009/02/04/421.shtml

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics