Posted by Colin McKinnon on 06/16/05 17:14
Chris Hope wrote:
> Angelos wrote:
>
>> What do you think is the best way to store Dates into a database ?
>> If you want to keep logs or buckups....
>
>
> Use the date or datetime field type - the exact name of the type depends
> on your DBMS.
>
Good advice.
> Otherwise you can use the PHP function strtotime() to change it to a
> timestamp and then date() to format it as you wish. The downside with
> this is you are limited to the range of a unix timestamp which is from
> 1970 to 2038.
>
strtotime() is very american in its interpretation of dates. Also Unix
timestamps are a bad way to store dates - even if you are running on a 64
bit system (i.e. can work with timestamps after 2036, which isn't so far
away now) you can't work with timestamps before 1970.
HTH
C.
[Back to original message]
|