strtotime() reads the timestamp in en_US format if you want
to change the date format with this number, you should
previously know the format of the date you are trying to
parse. Let's say you want to do this :
strftime("%Y-%m-%d",strtotime("05/11/2007&quo
t;));
It will understand the date as 11th of may 2007, and not 5th
of november 2007. In this case I would use:
$date = explode("/","05/11/2007");
strftime("%Y-%m-%d",mktime(0,0,0,$date[1],$date[0]
,$date[2]));
Much reliable but you must know the date format before. You
can use javascript to mask the date field and, if you have a
calendar in your page, everything is done.
Thank you.
----
Server IP: 194.145.210.4
Probable Submitter: 81.149.30.53
----
Manual Page -- h
ttp://www.php.net/manual/en/function.strtotime.php
Edit -- https://master
.php.net/note/edit/78988
Del: integrated -- h
ttps://master.php.net/note/delete/78988/integrated
Del: useless -- http
s://master.php.net/note/delete/78988/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78988/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78988/spam
Del: non-english --
https://master.php.net/note/delete/78988/non-english
Del: in docs -- http
s://master.php.net/note/delete/78988/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78988
Reject -- https://mast
er.php.net/note/reject/78988
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|