Code Snippet(2)>หาความแตกต่างระหว่างวันที่
ใช้ TimeSpan ช่วยในการเก็บตัวเลข เพื่อใช้ในการแสดงในรูปแบบแตกต่างกันไป
DateTime d1 = new DateTime( 2000, 7, 13 );DateTime d2 = new DateTime( 2003, 12, 5 ); TimeSpan s = d2 - d1; int numberofdays = s.TotalDays
References
For more information on the DateTime structure visit MSDN at microsoft here
For more information on the TimeSpan structure visit MSDN at microsoft here
ให้ความเห็น