VB.NET Days, hours, minutes, seconds between two dates

Anything related to Microsoft Visual Studio VB.NET and ASPX
Post Reply
Admin
Site Admin
Posts: 8
Joined: Thu Sep 05, 2019 19:11
Location: England
Contact:

VB.NET Days, hours, minutes, seconds between two dates

Post by Admin » Tue Sep 17, 2019 07:44

To get the date diff in days, hours, minutes and seconds

Code: Select all

Dim MySpan As TimeSpan = MyDate1 - MyDate2
txtMyTextBox.Text = String.Format("{0:%d} days, {0:%h} hours, {0:%m} minutes, {0:%s} seconds", MySpan)

Post Reply