Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

Problem with DateTime.ParseExact in Azure Functions for September and Australia CultureInfo

Open Rithwik-Bojja opened this issue 2 years ago • 1 comments

Azure Functions DateTime is not parsing with CultureInfo("en-AU") but parsing successfully with InvariantCulture.

Below code doesnot work:

var date = "4 Sep 2023";
var valParsed = DateTime.ParseExact(date, new[] { "d MMM yyyy" }, new CultureInfo("en-AU"), DateTimeStyles.None);

and Below code works:

 var rithdate = "7 Dec 2023";
            if (DateTime.TryParseExact(rithdate, new[] { "d MMM yyyy" }, CultureInfo.InvariantCulture, DateTimeStyles.None, out var rithparse))
            {
                _logger.LogInformation($"Hello Rithwik, Parsed Date: {rithparse}");
            }

can you explain why it is not working with CultureInfo("en-AU")

Refer this Stack Overflow for the same.

Rithwik-Bojja avatar Jan 08 '24 07:01 Rithwik-Bojja

Thanks for reporting pls hare all the repro steps.

bhagyshricompany avatar Jan 16 '24 10:01 bhagyshricompany