You are here: Re: Date formatting issue « All PHP « IT news, forums, messages
Re: Date formatting issue

Posted by Matt on 08/06/06 13:18

"J.O. Aho" <user@example.net> wrote in message
news:4jl5bgF8i5rqU1@individual.net...
> Matt wrote:
>> I am attempting to format date values returned from a database
>>
>> // snippet of code
>> while ($myrow = mysql_fetch_array($result)) {
>> $offr_vsdate = $myrow[offr_vsdate];
>> //
>>
>> If I echo the date 'as it comes'
>> echo $offer_vsdate;
>> I get the output: 2006-08-01
>>
>> But if I try to format the date as follows
>> echo date("d/m/Y",$offer_vsdate);
>> I get the output: 01/01/1970
>
> date don't take a string as argument, it needs a time value.
> http://www.php.net/manual/en/function.date.php
>
> You can try with
> echo date("d/m/Y",strtotime($offer_vsdate));
>

Many thanks, this worked a treat.

Regards
Matt

 

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

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