發表文章

目前顯示的是 3月 2, 2014的文章

[PHP] "time ago" function

To get a time different between now and input time if you want to check the different between now and set date. you can use this function. function   time_passed ( $timestamp ) {       //type cast, current time, difference in timestamps       $timestamp         =   ( int )   $timestamp ;       $current_time     =   time ( ) ;       $diff              =   $current_time   -   $timestamp ;             //intervals in seconds       $intervals         =   array   (           'year'   =>   31556926 ,   'month'   =>   2629744 ,   'week'   =>   604800 ,   'day'   =>   86400 ,   'hour'   =>   3600 ,   'minute' =>   60     ...