php - Compare timestamp to date -
i need compare timestamp date. compare date portion without time bit. need check whether timestamp occurs on day before yesterday i.e. today - 2.
could show me snippet please? thank you.
i've been reading through php docs couldn't find clean way of doing this. found converting timestamp date particular format , comparing date doing time delta date before yesterday , converting particular format. messy.
you can arcieve using function strtotime.
to round day personaly edit timestamp. notations of seconds since epoch. 1 day 86400 seconds, if following caculation:
$time = $time - ( $time % 86400 );
you can convert date again date function of php, example:
$readableformat = date( 'd-m-y', $time );
there on internet topic.
Comments
Post a Comment