#region 时间转换
/// <summary>
/// 时间转换
/// </summary>
/// <param name="time">日期格式 Jul 24 2014 8:28:03:506AM</param>
/// <returns></returns>
public DateTime CovnertTime(string time)
{
try
{
CultureInfo infoCulture = CultureInfo.CreateSpecificCulture("en-US");
string format = "MMM dd yyyy h:mm:ss:ffftt";
DateTime dt = DateTime.ParseExact(time, format, infoCulture);
return DateTime.ParseExact(dt.ToString("dd-MM-yyyy HH:mm:ss"), "dd-MM-yyyy HH:mm:ss", null);
}
catch (Exception ex)
{
CultureInfo infoCulture = CultureInfo.CreateSpecificCulture("en-US");
string format = "MMM dd yyyy h:mm:ss:ffftt";
DateTime dt = DateTime.ParseExact(time, format, infoCulture);
return DateTime.ParseExact(dt.ToString("dd-MM-yyyy HH:mm:ss"), "dd-MM-yyyy HH:mm:ss", null);
}
}
#endregion
欧美时间转换
最新推荐文章于 2022-07-15 09:03:09 发布