Reply to Re: More noob nonsense - output format for a timestamp date variable

Your name:

Reply:


Posted by Gordon Burditt on 04/27/06 06:30

>>
>> SELECT DATE_FORMAT(stamp, '%m/%d/%y'), ...
>> if you absolutely insist on writing non-Y2K-compliant code.
>>
>> Gordon L. Burditt
>
>
>Thanks.
>
>$last_donation=mysql_query("SELECT DATE_FORMAT($year_data[2],
>'%j/%n/%Y'");
>
>gave me what I wanted. $last_donation was a variable that I later
>echoed, and year_data was a result array into which I'd fetched data,
>including a TIMESTAMP data field.

This won't work. Best case, $last_donation is a MySQL result handle,
not a string. You need to fetch a row and get the right element
and echo *that*.

Ideally, you don't use a separate query, you get the timestamp in
the format you want it (using DATE_FORMAT) instead of the format MySQL
uses (just selecting the timestamp field).

>I'm all for Y2K compliance (I won't, however, be around when Y10K
>becomes an issue...), but in this case, I'm simply displaying a date in
>a format that, I think, seems to appeal to the majority of people in the
>US who think of dates as just dates and not data.
>
>Thanks for your patience in answering my trivial questions.

[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

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