vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all, I have two columns representing start_datetime and end_datetime. They look like 1085008980 and 1085009504 respectively. They are stored in UTC format (number of seconds from '15/12/1970'). How do I calculate difference in hours:minutes:seconds? Thanks, Eugene |
| |||
| Eugene wrote: > Hi all, > I have two columns representing start_datetime and end_datetime. They > look like 1085008980 and 1085009504 respectively. They are stored in > UTC format (number of seconds from '15/12/1970'). > How do I calculate difference in hours:minutes:seconds? > > Thanks, > Eugene > Are they date columns? If so (and they *should* be), simply subtract. As they are numbers, simply subtract, and do some math, you know, like dividing through the number of seconds in a minute, in an hour, etc. I don't know where you had the idea UTC has a format that does something magical with the year 1970. UTC is a time *zone*, not a format. Formerly known as Greenwich time. -- Regards, Frank van Bortel |
| |||
| Eugene wrote: > Hi all, > I have two columns representing start_datetime and end_datetime. They > look like 1085008980 and 1085009504 respectively. They are stored in > UTC format (number of seconds from '15/12/1970'). > How do I calculate difference in hours:minutes:seconds? > > Thanks, > Eugene - Difference in seconds between these two values = 524 - Number of seconds in 1 minute = 60 - Number of seconds in 1 hour = 3600 Requires simple math to return this from a plsql function as 'HH:MI:SS'. Hours := floor(524/3600) = 0 Minutes := floor((524 - (3600 * Hours))/60) = 8 Seconds := floor(524 - ((3600 * Hours) + (60 * Minutes))) = 44 Regards /Rauf |
| Thread Tools | |
| Display Modes | |
|
|