日期格式化处理

string today = "";
            string yesterday = "";
            string format = "yyyy-MM-dd hh:mm:ss";
             today = System.DateTime.Now.ToString(format, DateTimeFormatInfo.InvariantInfo);
             yesterday = DateTime.Now.AddDays(-1).ToString(format, DateTimeFormatInfo.InvariantInfo);
            string DayTodaty = today.Substring(0,10);
             today = DayTodaty + " 12:00:00";
            string Dayyesterday = yesterday.Substring(0,10);
             yesterday = Dayyesterday + " 12:00:00";

DateTime.Parse(ds.Tables[0].Rows[0]["Time"].ToString()).ToString("yyyy年MM月dd日 hh时mm分")).ToString()

你可能感兴趣的:(日期格式化)