下列程式可算出以今天為準的話,7天前是星期幾

 

DateTime PastDate=new DateTime();

 

PastDate = DateTime.Now;

 

TimeSpan ts = new TimeSpan(7,0,0,0);

 

PastDate = PastDate.Subtract(ts);

 

PastDate.ToShortDateString();

 


arrow
arrow
    全站熱搜

    welkingunther 發表在 痞客邦 留言(0) 人氣()