Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

difference of two datetimes

Status
Not open for further replies.

atropozzz

Programmer
Joined
Mar 19, 2002
Messages
16
Location
AT
hi everybody!

i got a quick question: can't find a function in vb.net with which i can calculate the difference of 2 given dates (in days). anybody got an idea?

thanx in advance!

atro
 
Hi,
The Same DateDiff functions is also there in VB.NET u can try this

Dim firstDate As Date
Dim secondDate As Date
firstDate = Now()
secondDate = Now()
firstDate = firstDate.AddDays(11)
MsgBox(DateDiff(DateInterval.Day, secondDate, firstDate))
 
yep, that's what i was looking for!

grazie!
 
Did you try a simple subtraction?

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top