Azure-Functions
Azure-Functions copied to clipboard
Problem with DateTime.ParseExact in Azure Functions for September and Australia CultureInfo
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.
Thanks for reporting pls hare all the repro steps.