Re: convert date format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try

preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}))#', $row['date'], $matches);
$month = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$converted_date = $matches[3]." ".$month[$matches[2]]. " ".$matches[1];

untested...
               


On Thu, 24 Mar 2005 12:52:04 +0200, Angelo Zanetti <angelo@xxxxxxxxxxxx> wrote:
> hi guys,
> 
> I need to convert a date from this format: 2005-03-25 to 25 mar 2005.
> I have tried the mktime, strftime and the date functions but they all
> take a time stamp but I only have the dates in the format of 2005-03-25.
> 
> These are what i tried where $row['date'] is 2005-02-24 but they all
> return 01 Jan 1970???
> 
> echo(mktime(0,0,0, date("j", $row['date']),  date("M", $row['date']),
> date("Y", $row['date'])));
> echo(strftime("%d", $row['date']) . " " . strftime("%b", $row['date']).
> " " . strftime("%Y", $row['date']));
> echo(date("d",$row['date'] ) . " " . date("M", $row['date']) . " " .
> date("Y",$row['date'] ));
> 
> thanks in advance
> angelo
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux