I have a date string that looks like so.

02/12/2005 02:20

the format is dd/mm/yyyy hh:mm

i need to change that string to look like so.

2005-12-02 02:20

the desired format is

yyyy/mm/dd

i tried

strftime("%d-%m-%Y %H:%M", strtotime("02/12/2005 03:08"));

but that seems assume the string "02/12/2005 03:08" is 12 Feb 2005. I need to change that so that the string is read as 02 Dec 2005.

please help.

    Check up on the examples at the [MAN]date[/MAN] manual page

      dalecosp, the klugemeister strikes again!

      [563] Sat 03.Dec.2005 13:52:07
      [kadmin@archangel][~/scripts]
      cat date.php
      <?php
      
      $str = "02/12/2005 02:20";   
      $split = preg_split("/\//","$str"); $newstr = $split[1]."/".$split[0]."/".$split[2]; echo date("M/d/Y",strtotime($newstr)). "\n"; ?>

      WARNING: This script is such an awful kluge it will likely:

      1. Get me laughed out of the EL....
      2. Slow down most POSIX compliant operating systems....
      3. Kill Win2003 servers....

      😃

      But, I've not played with PCRE's for a few moons ... good practice.

      Welcome to PHPBuilder, BTW ...

        Write a Reply...