Possible Duplicate:
Showing Difference between two datetime values in hours
Hi,
is there an easy way to get the difference between 2 DateTime-Values in Hours?
I know, its a possibility to calculate itself by get for each day difference 24h, for each month 188h and so on… but is there an easy way given mybe?
Example:
1) 01.02.2010 12:00
2) 03.03.2011 14:00
= ? Hours differnce
It’s pretty simple:
Note that if these
DateTimevalues have been taken locally, the results may not be the number of elapsed hours. For example, you could have oneDateTimeof midnight and one of 2am, but only one hour had elapsed – because the clocks went forward at 1am. This may or may not be an issue for you. It won’t be a problem if you’re dealing with UTCDateTimevalues.