DateTime dt = System.DateTime.Now;//定義dt獲取系統的現在時間,各式為:YY-DD-HH MM:SS
this.txb_enddate.Text = dt.ToShortDateString();//ToShortDateString()函數,將dt轉換成短日期格式,即格式:YY-DD-HH。 this.txb_enddate(文本框)。
this.txb_ruyuantime.Text = dt.TimeOfDay.ToString()//TimeOfDay.ToString()函數,將dt轉換成短日期格式,即格式:mm:ss。this.txb_ruyuantime(文本框)。