DateTime

  • Thread starter Thread starter bbawa1
  • Start date Start date
B

bbawa1

I have a date
startdate = '6/20/2007 11:21 AM'

enddate = Datetime.now
I want to calculate the difference betewwn enddate-startdate and then
convert it into hours.
How can I do that in asp.net

Thanks
 
Hi,

I have a date
startdate = '6/20/2007 11:21 AM'

enddate = Datetime.now
I want to calculate the difference betewwn enddate-startdate and then
convert it into hours.
How can I do that in asp.net

Thanks

Simply do

TimeSpan duration = endDate - startDate;
int hours = duration.Hours;

HTH,
Laurent
 
Back
Top