   [web] Time from a timestamp in PHP
  I have a UNIX timestamp that I need to convert into hours:minutes:seconds. I tried using gmstrftime("%H:%M:%S", $timestamp) but that does not return the total hours.  An example is say the timstamp equals 54 hours, 36 minutes, 54 seconds in GMT, what function in PHP would return that correctly?Thanks!   
  Er, timestamp's do not equal 54 hours, 36 minutes, 54 seconds, an interval, however, does.Are you wanting to get the interval from one point in time to another? Or are you wanting to get the hour, minutes and seconds from a timestamp? I ask this because it seems you're wanting an interval but are pulling it based on a single timestamp with no other point of reference, which an interval needs (unless you're counting from the beginning of time).   ;Quote:Original post by MathachewEr, timestamp's do not equal 54 hours, 36 minutes, 54 seconds, an interval, however, does.Are you wanting to get the interval from one point in time to another? Or are you wanting to get the hour, minutes and seconds from a timestamp? I ask this because it seems you're wanting an interval but are pulling it based on a single timestamp with no other point of reference, which an interval needs (unless you're counting from the beginning of time).Ah yes, you're right. I'll try to explain more what I need then to see if anyone has a solution. I'm calculating the interval between two times and adding them to a timestamp(I first convert the two times into timestamps). At the end I then have the timestamp with the total time of all the intervals added together, correct? If that's true then I need that time returned in the format of total hours, minutes, and seconds. What would be the best way to go about doing this?I appreciate the help so far.   ;Quote:Original post by ThirdAh yes, you're right. I'll try to explain more what I need then to see if anyone has a solution. I'm calculating the interval between two times and adding them to a timestamp(I first convert the two times into timestamps). At the end I then have the timestamp with the total time of all the intervals added together, correct? If that's true then I need that time returned in the format of total hours, minutes, and seconds. What would be the best way to go about doing this?I appreciate the help so far.http://aidan.dotgeek.org/repos/?file=Duration.phpThis script returns the duration based on the number of seconds passed to it. Hope this helps.   ;  You should look at PEAR's Date and Date_Span classes.   