You are here: Re: [PHP] convert date format-SOLVED « PHP « IT news, forums, messages
Re: [PHP] convert date format-SOLVED

Posted by Angelo Zanetti on 03/24/05 13:06

Hi guys,

got it to work:

$datearr = split('-', $row['date']);
$tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]);
$myformat = date('j M Y',$tstamp);
echo 'myformat: ' . $myformat;

hope this can help others!!
Angelo
Angelo Zanetti 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


--

Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация