You are here: Re: FormatDateTime in PHP « PHP Programming Language « IT news, forums, messages
Re: FormatDateTime in PHP

Posted by Mladen Gogala on 10/07/54 11:36

On Thu, 05 Jan 2006 06:50:25 -0800, John K wrote:

> I recently took a job doing PHP but come from an ASP background. I'm
> trying to find a conversion equivalent for VBScript's "formatdatetime".
>
> All I want to do is convert a MySQL datetime field into a long date.
> e.g. 2006-01-30 to January 1, 2006.
>
>
> PLEASE provide an example that I can use as a future benchmark so I can
>
> understand the syntax better. I really need to learn PHP and I'm a
> little freaked out right now.
>
>
> Thanks!


That's what PEAR Date is for. Here is the example you provided:


$ php /tmp/ttt.php
January 01, 2006
$ cat /tmp/ttt.php
<?php
require_once("Date.php");
$d=new Date("2006-01-30 00:00:00");
echo $d->format("%B %m, %Y"),"\n";
?>

--
http://www.mgogala.com

 

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

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