源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

自定义时间格式转换代码分享

  • 时间:2021-01-20 08:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:自定义时间格式转换代码分享
[u]复制代码[/u] 代码如下:
/// <summary>         /// 将日期字符串转换为日期类型         /// </summary>         /// <param name="strDateTime">形如"2012年5月14日"的日期字符串</param>         private DateTime ParseDateTime(string strDateTime)         {             ////Like: string strDateTime = "2012年5月14日";             DateTime dateTime;             if (DateTime.TryParseExact(strDateTime, "yyyy年M月d日", new System.Globalization.CultureInfo("en-US"), System.Globalization.DateTimeStyles.AssumeLocal, out dateTime))             {                 return dateTime;             }             else             {                 return DateTime.Today;             }         }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部