简体   繁体   中英

excel date format not working mm/dd/yyyy to yyyy-mm-dd

Have a column defined as Date yyyy-mm-dd: Date format setting The 2020-04-13 date is the existing data. I pasted in new data 03/31/2020.
I tried doing format painter to apply the cell with 2020-04-13 to 03/13/2020, but the format would not change. Also checked the Date format dialogue as show above, both cells show the same setting. Why is the 03/31/2020 not changing to the desired yyyy-mm-dd format?

BTW, In my windows date format settings, I have: Windows date format setting在此处输入图像描述

@Scott Cramer answered your question but didn't provide a solution. That lies in how you enter the date[s] you want to format.

If you enter a date in a cell that is formatted as Date Excel will record a "True date" which is a number that is converted to look like a date by the cell format. If Excel doesn't recognize your entry as a date, even if you do, the entered value will be recorded as a text string, just what you entered, and I'll call it a "fake date". You can see that it doesn't really matter what you enter or what format you set, only what Excel understands.

Excel understands what you have set up in Windows settings. Now, you see that your settings are confusing. The long date is set up as Month, Day, Year whereas the Short date gas it Year, Month, Day. I haven't tried whether this will be an issue of significance because it's unlikely that you will enter a Long date in a cell and ask Excel to recognize it as a true date. Most of the time Short dates will be entered. Based on your settings you should enter "2020-3-13". If you want "31-3-2020" to be recognized as a date when you enter it in a cell you must change the setting to the Month, Day, Year sequence.

Two notes in this regard.

  1. In most cases you don't need to enter all four digits of the year. Excel will interpret the last two correctly.
  2. The date separators are important. If your set format has dashes Excel won't understand slashes and vv

And, finally, you can change the format of a cell containing a date to General or Number and see the number underlying a true date. You can also try a calculation. If A1 contains a true date then =A1+1 will return a date of the next day.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM