|
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]
|