DateTime

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
 
L

Laurent Bugnion, MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top