how to convert time() output to a date in php -
this question has answer here:
i using time() command in php store timestamp value every time database updated i.e whenever value updated in database timestamp added in time.
for eg: when change made database yesterday night, value added 1368132319.
i know the time() commands returns no of seconds elapsed jan 1 1970.
now want convert these no of seconds user understandable form can displayed on html page. these seconds converted date , time.
how do that? cannot think of logic implement it. googled no avail
pretty simple thing, use datetime
$date = date_create(); date_timestamp_set($date, 1171502725); echo date_format($date, 'u = y-m-d h:i:s') . "\n"; all in manual http://php.net/manual/en/datetime.settimestamp.php
Comments
Post a Comment