mysql üzerinde varchar olarak tutulan tarih bilgisini (“yyyymmdd”) farklı bir tarihe kaydırma örnekleri:
SELECT wordoftheday, DATE_FORMAT ( DATE_ADD( STR_TO_DATE(wordoftheday,'%Y%m%d') , INTERVAL 3 YEAR), '%Y%m%d') AS newwordoftheday FROM crosslanguage WHERE wordoftheday<>'' ORDER BY wordoftheday DESC
wordoftheday newwordoftheday
20171201 20201201
20171130 20201130
20171130 20201130
20171129 20201129
Tarihleri 3 yıl ötele:
UPDATE `crosslanguage` SET `wordoftheday` = DATE_FORMAT ( DATE_ADD( STR_TO_DATE(wordoftheday,'%Y%m%d') , INTERVAL 3 YEAR), '%Y%m%d') WHERE wordoftheday<>''
Tarihleri 2 ay ötele:
UPDATE `crosslanguage` SET `wordoftheday` = DATE_FORMAT ( DATE_ADD( STR_TO_DATE(wordoftheday,'%Y%m%d') , INTERVAL 2 MONTH), '%Y%m%d') WHERE wordoftheday<>''