The formatting for function date and the clase Datetime() be next:
$date = new DateTime('now');
echo $date->format('M d Y h:i A');
Exit:
Nov 07 2014 03:03 PM
The way you’re with the percentages it looks like you’re using the function strftime().
Formatting for strftime
%b - Mês abreviado (jan-dec)
%d - dia (01-31)
%Y - Ano com quatro digitos (2014)
%h - Mês abreviado conforme o locale (jan-dec)
%i - Hora representada de 01 a 12
%p - Adiciona AM ou PM
Date equivalent
M - Mês abreviado (jan-dec)
d - dia (01-31)
Y - Ano com quatro digitos (2014)
? - Não tem é possível formatar a data utlizando locale
h - Hora representada de 01 a 12
A - Adiciona AM ou PM
If you need to format the date using the locale see that question.
What is the format that returns $this->data ? put an example.
– Rafael Dias Soares
Returns this value: 2014-09-19 00:32:26 Now I wanted to change to American format.
– Marta
00 can be in AM PM or 24h format. As you know if it is in 12h or 24h format?
– Jorge B.
Using date()/Datetime or strftime() to format?
– rray
gives me the following error: Fatal error: Call to a Member Function DATE_FORMAT() on a non-object in C: xampp htdocs Prototype Phpclasses Post.php on line 117 sei k is in 24h format, because in the other examples I have prints in this format. I’m using the now function()
– Marta