user892134
user892134

Reputation: 3224

MySQL timestamp column not updating

This is the query returned

UPDATE `casts` SET `cast_name` = 'Test Name', `date_of_birth` = '1968-05-10 00:00:00' WHERE `id` =  '148'

I've also tried this query

UPDATE `casts` SET `cast_name` = 'Test Name', `date_of_birth` = '1968-05-10' WHERE `id` =  '148'

For some reason date_of_birth is not updating?

date_of_birth is timestamp default NULL.

How to solve?

Upvotes: 0

Views: 32

Answers (1)

nagendra patod
nagendra patod

Reputation: 289

MySQL TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. hence you can't give "1968-05-10" value to date_of_birth timestamp field.

if you want to store "1968-05-10" then you can use DATETIME fields. DATETIME range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'

Reference : https://dev.mysql.com/doc/refman/8.0/en/datetime.html

Upvotes: 1

Related Questions