04-15-2015 03:28 PM
I have a column, TimePlayed, and its value is in second. How do I convert that to hours. I used the function HOUR but I don't it give me the correct value.
Furthermore ,I have two columns indicating the start time and end time if there is any way to get hours played.
04-15-2015 03:40 PM
If timeplayed is in seconds then code:
hoursplayed = timeplayed/ 3600;
Do you need whole hours or fractions?
The HOUR function returns the value of the hour portion of a datetime or time variable. For your first example of StartTime the hour function would return 16.
You can use the function INTCK with two datetime variables to return the number of hour intervals but may not provide what your are looking for if you want fractions of an hour.
04-15-2015 03:51 PM
And if both of your variables are datetime you can subtract them to get a duration of time played which would be in seconds.
format duration time8.;