MySQL: dates before 1970

前端 未结 1 509
忘掉有多难
忘掉有多难 2020-12-10 14:04

I\'m working on a church site which has many events before 1970, these events starts from 1001 to today, how can I store the dates in MySQL

相关标签:
1条回答
  • 2020-12-10 14:22

    DATE is fine. It can store values from 1000 to 9999 AD.

    The DATE type is used when you need only a date value, without a time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

    It's different with PHP's old-style date functions (date(), strtotime()....) these work with UNIX timestamps and, when using 32-bit values, are limited to a date range from 1970 to 2038.

    To work with date values beyond that, work with PHP 5's new object-oriented DateTime class.

    0 讨论(0)
提交回复
热议问题