php - How can I format my timestamp right? -
i have timestamp mysql database , format it.
$date = $row['date']; $date = date("f j, y, g:i a");
my problem prints not date of database. instead prints out current date. not need.
so if print this, right date:
printf($row['date']);
but if print right format not right date:
printf($date);
you need pass date, unix timestamp, date()
second parameter. otherwise date()
has no idea want format specific date:
$date = date("f j, y, g:i a", strtotime($row['date']));
this assumes $row['date']
in valid date format.
Comments
Post a Comment