|
Posted by Michael Fesser on 01/11/07 20:44
..oO(Vincent Delporte)
>On 10 Jan 2007 20:02:21 -0800, "ZeldorBlat" <zeldorblat@gmail.com>
>wrote:
>>I prefer to keep datetime values as timestamps until the last possible
>>moment when I format them for display.
>
>Thanks for the idea, but I still have to display dates as dd/mm/yyyy
>since this is the normal way to display dates over here.
Sure, where's the problem?
>Isn't there a way to configure MySQL to save dates this way, and avoid
>massaging dates between PHP and MySQL?
That's not possible and you don't really want that. Storing dates as
DATE or DATETIME allows the database to do a lot of date calculations
and manipulations. That's why such column types exist.
>That would also make SELECTs
>easier (SELECT * from, instead of having to name all columns just to
>call some date function like UNIX_TIMESTAMP() or DATE_FORMAT() ).
That's how it's supposed to be. Either let the DB return an already
formatted date or a Unix timestamp so PHP can do the rest. Additionally
you should never use SELECT * in a productive application, but list all
fields explicitly.
Micha
[Back to original message]
|