I’m putting the current time and date in MySQL using
$datecreated = date("Y-m-d, g:i:s A");
Then showing it to the user with
$datecreated = date('n-j-Y, g:i:s A', strtotime($row['datecreated']));
Everything works great, except that the time is always AM. I’ve tested this in the morning and afternoon, and still AM.
Use the
date("Y-m-d H:i:s")(24 hour notation) when writing to the database.Otherwise the ” PM” (or ” AM”) part just gets truncated, leaving you with always “AM” situation.