RES: [PHP] From 24/7/2013 to 2013-07-24

[email protected] (Alejandro Michelin Salomon)
Newsgroups php.general
Message-ID <[email protected]>
Use this:

echo preg_replace('#(\d{2})/(\d{2})/(\d{4})#' , "\\3-\\2-\\1", '24/07/2013'
); RESULT => 2013-07-24

Alejandro M.S


-----Mensagem original-----
De: Jim Giner [mailto:[email protected]] 
Enviada em: sexta-feira, 26 de julho de 2013 11:12
Para: [email protected]
Assunto: Re: [PHP] From 24/7/2013 to 2013-07-24

On 7/26/2013 10:10 AM, Jim Giner wrote:
> I think you should change from using 'rsort' ( a SORT function) to 
> 'array_reverse', a simple reverse function.
> Your example of what you desire is wrong.
> 24-7-2013 will give you the 2013-24-7 that you want.

oops.
I meant to say "will NOT give you the 2013-2407 that you want".


--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.