Reply to Re: How to manipulate date?

Your name:

Reply:


Posted by Krustov on 12/08/05 04:44

<comp.lang.php , Greg Scharlemann , greg.scharlemann@gmail.com>
<1134000933.320089.29550@g49g2000cwa.googlegroups.com>
<7 Dec 2005 17:46:43 -0800>

> If I have a date that looks like: 2005-12-07 10:10:00
>
> How could I manipulate it in php to say "Dec, 07, 2005"?
>
> I can separate the string at the space, but don't know where to go from
> there....thanks for any suggestions.
>

A luddite method and no doubt a geek will post a much better way of
doing it :-)


Strip out everything except 2005-12-07

<?php

$junk="2005-12-07";

$temp1=substr($junk,0,4);
$temp2=substr($junk,5,2);
$temp3=substr($junk,8,2);

$change=str_replace("01","Jan",$temp2);
$change=str_replace("02","Feb",$temp2);
$change=str_replace("03","Mar",$temp2);
$change=str_replace("04","Apr",$temp2);
$change=str_replace("05","May",$temp2);
$change=str_replace("06","Jun",$temp2);
$change=str_replace("07","Jul",$temp2);
$change=str_replace("08","Aug",$temp2);
$change=str_replace("09","Sep",$temp2);
$change=str_replace("10","Oct",$temp2);
$change=str_replace("11","Nov",$temp2);
$change=str_replace("12","Dec",$temp2);

$join="$change" . ", " . "$temp3" . ", " . "$temp1";

print $join;

?>

[Back to original 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

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