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