|
Posted by Colin McKinnon on 12/18/33 11:49
NC wrote:
> Des wrote:
>>
>> I am displaying records from a table including a stored date. When
>> display $row[Date], i get the obvious 2006-05-21. However this is not
>> what the guy wants. He wants 21-May-2006.
>
> First of all, make it a habit to write $row['Date'], not $row[Date].
Good advice.
> The latter works for now, but may stop working in the future without
> warning. This said, the code snippet you are looking for can look like
> this:
>
> date('j-M-Y', strtotime($row['Date']))
>
strtotime() is very americanized. And 32 bit timestamps suck. A better
solution is to do the formatting in the DBMS if possible - assuming it's
MySQL, then use the DATE_FORMAT() function for Oracle, TO_CHAR() - don't
know about the rest.
HTH
C.
Navigation:
[Reply to this message]
|