DateTime Formatting on Azure hosted site

so my tech stack is: asp.net core 1.1 hosted on Azure using CSV Helper to read CSVs into a SQL database (in azure).

ok so the problem i'm facing is when i'm using CSV helper locally its all fine, the date format is reading it as per the CSV file into the format i want (dd/mm/yyyy i'm in sydney).

when i import a file hosted on the azure site.. my date formats are screwed (they are converting to the US).

how do i go about importing those dates correctly using CSV Helper?

in my startup.cs i have the following:

    //Currently only supports en-AU culture. This forces datetime and number formats to the en-AU culture regardless of local culture
    var auCulture = new CultureInfo("en-AU");
    var supportedCultures = new[] { auCulture };
    services.Configure<RequestLocalizationOptions>(options =>
    {
        options.DefaultRequestCulture = new RequestCulture(auCulture, auCulture);
        options.SupportedCultures = supportedCultures;
        options.SupportedUICultures = supportedCultures;
    });

and i'm using UTC across the site, but since these datetimes are coming from CSVHelper, that seems to be screwing up my format.

any ideas?

cheers,

Jon Skeet
people
quotationmark

If you want to make sure CsvHelper always uses one particular culture, you can set it explicitly:

csv.Configuration.CultureInfo = auCulture;

You should bear in mind, however, that a DateTime doesn't "store" a format - so once you've parsed the value in the CSV file, you've just got a DateTime value... you may well need to explicitly control any later formatting of that value for the UI or other output.

people

See more on this question at Stackoverflow