i have 2 time stamp values and i want to subtract them then i want to extract the difference of days between them by date(“d”,$new_ts) but if the subtract result is 0 i get 31 from the date function ?? how to do it ?
@NogDogJan 02.2008 — #That's because a PHP time value is the number of seconds since January 1 1970 00:00:00 GMT. If your server's time zone is west of the GMT zone, then 0 will be interpreted as December 31 1969, thus the result of "31" for the day in the date() function.
The quick-and-dirty solution is to divide the difference by 60*60*24, rounding up or down as applicable to your purposes (see the ceil(), floor() and round() functions).