q; find day passed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dim ts As TimeSpan = crun.Subtract(lrun)

I am using this to find the elapsed time, is there any way I can do this
comparison without time part, such as if lrun=07/16/2006 and crun=07/17/2006
I need to return 1 since there has been 1 day passed.
 
JIM.H. said:
Dim ts As TimeSpan = crun.Subtract(lrun)

I am using this to find the elapsed time, is there any way I can do this
comparison without time part, such as if lrun=07/16/2006 and crun=07/17/2006
I need to return 1 since there has been 1 day passed.

You can use the DateTime.Date property to return the original DateTime
but with the time portion set to midnight.
 
if I have lrun.Date and crun.Date, how should I compare what is the
difference between these dates in terms of days? Can you give me example?
 
JIM.H. said:
if I have lrun.Date and crun.Date, how should I compare what is the
difference between these dates in terms of days? Can you give me example?

Subtract one from the other as you're doing now, then use the Days
property of the resulting TimeSpan.
 
Back
Top