string sdt ;
System.DateTime dt = System.DateTime.Now
sdt = dt.Year.ToString()+"."+dt.Month.ToString().PadLeft(2,'0')+"."+dt.Day.ToString().PadLeft(2,'0');
System.DateTime dt = System.DateTime.Now
sdt = dt.Year.ToString()+"."+dt.Month.ToString().PadLeft(2,'0')+"."+dt.Day.ToString().PadLeft(2,'0');
this.dateTime_KFDate.Format =System.DateTime.Now.ToString("YY.MM.DD");
可是为什么没有变化呢?
System.DateTime.Now.ToString("yyyy.MM.dd")
this.dateTime_KFDate.Format =System.DateTime.Now.ToString("YY.MM.DD");
可是为什么没有变化呢?
注意,哪里是小写,哪里是大写。
最好去查查csdn,找datetime.tostring();里面有各种参数的设置。
{
// Set the Format type and the CustomFormat string.
dateTime_KFDate.Format = DateTimePickerFormat.Custom;
dateTime_KFDate.CustomFormat = "yyyy.MM.dd";
}