php - strtotime() always returns same day of month but gets other parts of date correct -
i have part of simple web app takes input javascript calendar picker, sends server, , server converts human readable time , echos out.
my html form ends having value formatted mm/dd/yyyy.
when gets posted server php transforms differet format (please note i'm using codeigniter $this->input->post()
same $_post[]
):
php $date = date('l, f n, y', strtotime($this->input->post('date')));
example input , output
html text input value of "04/21/2013".
php's strtotime() echo "sunday, april 4, 2013".
no matter date put in there, strtotime() gives me correct date except day of month always ends being same number number of month (for example, dates in may become "may 5, 2013" , on).
update: solved
as posted realized 'n' in 'l, f n, y' caused issue. turning 'j' fixed things. sorry waste everyone's time.
use j
day of month, not n
numeric month:
php $date = date('l, f j, y', strtotime($this->input->post('date')));
Comments
Post a Comment