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

[email protected] (Karl-Arne Gjersøyen)
Newsgroups php.general
Message-ID <CAN78Z6ACipXP9jzsPTre5GQWoy=nDpYZn48BdMDJsYhuO8G2Lw@mail.gmail.com>
2013/7/26 Davi Marcondes Moreira <[email protected]>

> Hi! I suggest you to try this:
>
> $foo = DateTime::createFromFormat('d/m/Y');
> $newDate = $foo->format('Y-m-d');
>


Thank you veyr much. With a small modification this work perfec!

Karl


>  Em 26/07/2013 09:19, "Karl-Arne Gjersøyen" <[email protected]>
> escreveu:
>
> Below is something I try that ofcourse not work because of rsosort.
>> Here is my code:
>> -----------------------
>> $lagret_dato = $_POST['lagret_dato'];
>>     foreach($lagret_dato as $dag){
>>
>>         $dag = explode("/", $dag);
>>        rsort($dag);
>>         $dag = implode("-", $dag);
>>         var_dump($dag);
>>
>> What I want is a way to rewrite contents of a variable like this:
>>
>> From 24/7/2013 to 2013-07-24
>>
>> Is there a way in PHP to do this?
>>
>> Thank you very much.
>>
>> Karl
>>
>
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.