随笔-20  评论-32  文章-9  trackbacks-1
  2008年7月24日
//和历转西历
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;
        }
//西历转和历
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;
        }

posted @ 2008-07-24 16:55 冷风旋 阅读(54) | 评论 (0)编辑