9keng


Code Snippet(2)>หาความแตกต่างระหว่างวันที่

เขียนแล้วใน Programming โดย 9keng บน เมษายน 1, 2007
ใช้ 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


	

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Connecting to %s


Follow

Get every new post delivered to your Inbox.