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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving Excel to CSV changes date formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

145496 Jun 25,2019 03:22 PM UTC Jul 9,2019 05:37 AM UTC ASP.NET MVC 3
loading
Tags: XlsIO
Paul Meems
Asked On June 25, 2019 03:22 PM UTC

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

Abirami Varadharajan [Syncfusion]
Replied On 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 


Paul Meems
Replied On 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.

Abirami Varadharajan [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon