Welcome Guest, Not a member yet? Register   Sign In
How to get time difference? [SOLVED]
#1

[eluser]aryan_[/eluser]
I have two timestamp. I want to get the difference in hours(i.e. XX hours ago). How do I do this with either codeigniter or native php?

Thanks
#2

[eluser]vitoco[/eluser]
Code:
// timestamps
$t1 = 1000 ;
$t2 = 500 ;
// GET DIFF BETWEEN THE TWO TIMESTAMPS
$diff        = $t2 -$t1 ;
// CHANGE IT TO HOURS
$num_hours    = floor( $diff / ( 60*60 ) ) ;
#3

[eluser]aryan_[/eluser]
I also did the same, and it's working fine. It was so simple.

Thanks!
#4

[eluser]vitoco[/eluser]
please add [SOLVED] to the title, it saves time when you scan the forums




Theme © iAndrew 2016 - Forum software by © MyBB