We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Saving Excel to CSV changes date formatting

I have a Dutch Excelsheet which I save as a CSV-file.

On my local (Dutch) dev environment a cell value of `27-8-1990` is converted to CSV as `27-8-1990` which is expected.

My code needs to run on Azure and then the same value is converted to `8/27/1990` which is unexpected.
How can I tell the export not to alter my formatting?

Thanks,
Paul

5 Replies

AV Abirami Varadharajan Syncfusion Team June 26, 2019 01:57 PM UTC

Hi Paul, 

Greetings from Syncfusion. 

We suspect that the azure machine is running in US culture which may cause change in date format to US culture as ‘8/27/1990’. As per Microsoft Excel behaviour, the default date format is updated according to the machine culture. So, we request you to change the culture as Dutch using below code snippet before initializing ExcelEngine to resolve the issue. 

Code Example: 

            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL"); 
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-NL"); 
                  
                         ExcelEngine excelEngine = new ExcelEngine(); 
            IApplication application = excelEngine.Excel; 

Kindly try this and let us know if this resolves issue at your end. 

Regards, 
Abirami 



PM Paul Meems July 8, 2019 09:45 AM UTC

I've fixed it now by expanding my parse date method.
I don't feel comfortable changing the culture on the thread, for now it is OK.

This issue can be closed.


AV Abirami Varadharajan Syncfusion Team July 9, 2019 05:37 AM UTC

Hi Paul, 

Thank you for updating us. 

We are glad that your issue is resolved. Please let us know if you need further assistance. 

Regards, 
Abirami


AM Amey December 11, 2020 06:26 AM UTC

Can you please post your solution?


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 14, 2020 09:39 AM UTC

Hi Amey, 

Greetings from Syncfusion. 

We have already posted solution for this forum query. If you facing different scenario, we request you to post your query and version details of Syncfusion XlsIO for investigation. 

Regards, 
Keerthi.

Loader.
Live Chat Icon For mobile
Up arrow icon