Home > Software design >  In a mysql database replace all dates with a specific date
In a mysql database replace all dates with a specific date

Time:01-02

I have a mysql database and I want to change the "modified" date with a specific date.

In the "modified column I have several dates: "2016-08-15" "2015-05-08" etc... Now I want to change all these dates with an only date: "2021-12-31"

UPDATE jos_content SET modified = replace(modified, 'any date here', '2021-12-31’)

How can I do it?

CodePudding user response:

If I got you right this will set all the dates to 2021-12-31

UPDATE jos_content 
SET modified = '2021-12-31’

CodePudding user response:

UPDATE jos_content 
SET modified = '2021-12-31'
where modified in ('date1','date2'...)
  • Related