Coldfusion: cfspreadsheet reading date incorrectly

2019-08-30 01:25发布

问题:

Im using cfspreadsheet to read data from spreadsheets inside one of my applications. I've had a great deal of difficulty dealing with date columns. If I format the cell as date english (NZ) it displays right in the spreadsheet, but when I try to upload it switched the day and month. But If I change the format to a custom "dd/mm/yyyy" format it will upload without a problem.

Why would using the default date formats within the spreadsheet mess up the format when a custom one doesn't? Is there a work around?

回答1:

I was using the Date Type "*14/03/2001".

The * means that it will: respond to changes in regional date and time settings that are specified for the operating system.

So it must have been getting turned about by java or CF somewhere along the way. I changed it to the same date mask without the asterisk and the problem stopped occurring.