The date of Jan 01, 1901 converts to Jan 01, 2001 which is wrong. How is this done in Databricks?
%sql
Select '01-Jan-01' badDate, to_date('01-Jan-01','dd-MMM-yy') as date2, date_format('01-Jan-01','d-MMM-yy'),,date_format('01-Jan-01','dd-MM-yy'),date_format('01-01-01','dd-MM-yy');
Its unclear what you're asking but your date format string is incorrectly formated for one. You have dd-MMM-yy when it should be dd-MM-yy
Just a thought - since it is Databricks. Use a Python function to convert it using a cutoff date of '01-01-'+ year(date)
cutoff_date = pd.to_datetime('01-01-2023')
df.loc[df.date > cutoff_date, 'date'] -= pd.DateOffset(years=100)
Possible solution Easy way to fix wrong year (y2k bug) using pandas
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.