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