和历与西历之间的转换
//和歷轉(zhuǎn)西歷
private string DateTimeTransform(string pDate, string pFormat)
{
CultureInfo vCurrentInfo = new CultureInfo("ja-JP", true);
vCurrentInfo.DateTimeFormat.Calendar = new JapaneseCalendar();
DateTime vCurrentDate = Convert.ToDateTime(pDate, vCurrentInfo.DateTimeFormat);
string vReturnDate = vCurrentDate.ToString(pFormat, DateTimeFormatInfo.InvariantInfo);
return vReturnDate;
}
//西歷轉(zhuǎn)和歷
private string DateTimeTransform(string pDate, string pFormat)
{
CultureInfo vCurrentInfo = new CultureInfo("ja-JP", true);
vCurrentInfo.DateTimeFormat.Calendar = new JapaneseCalendar();
DateTime vCurrentDate = Convert.ToDateTime(pDate);
string vReturnDate = vCurrentDate.ToString(pFormat, vCurrentInfo.DateTimeFormat);
return vReturnDate;
}
總結(jié)
以上是生活随笔為你收集整理的和历与西历之间的转换的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jdk1.8 默认垃圾收集器为:Para
- 下一篇: shiro多账号登录(用户名,手机号,邮