I have a file with several date fields that I am trying to save to a CSV format. The dates in the file are all in YYYY-MM-DD format which is what I want it to stay in. If I export to excel it comes out correctly. If I export to CSV it is changing it to MM/DD/YYYY format. I have tried flipping the dates to a variety of Types which all look fine in excel and Alteryx but once I open the CSV they flip to MM/DD/YYYY. This file gets exported to a client system and immediately gets rejected if in MM/DD/YYYY. How can I keep the CSV showing correctly as YYYY-MM-DD? TIA!
Solved! Go to Solution.
I am not able to replicate this issue, but I have an idea of what might be happening. Are you opening the .csv file in Excel or in a text editor? Excel tries to nicely format dates for you according to your localization settings on your computer, even with a .csv file.
I've attached a simple workflow. It has a string input that has the same date format you want (but it's stored as a string), a DateTimeNow() formula to get a date field, and a DateTime parse tool that changes the format of that date and changes it into a string.
When I open this in a text editor, it looks like this: (I've formatted the last field "wrong" so the difference is noticeable. The format is configurable in the DateTime parse tool.)
Then I open the same file in Excel, and Excel nicely formats the date how I don't want.
Thanks Jeremy that fixed it! I thought I was going to lose my mind!