I’m getting this below error:
Assign- start date modification: String was not recognized as a valid DateTime.
I’m fetching data from the dictionary of type(String,String), and a date field from it has to be converted to a specific date format M/d/yyyy h:mm:ss tt.
type in the dictionaryData(“start_date”)
Explore with DateTime Parseformat is needed
do prototyping of the changed statement also within the immediate panel
integrate the changes into your xaml
In that case, try log message the date before you parse it.
The format string is "M/d/yyyy h:mm:ss tt". This means the date string should look something like this: "1/31/2024 2:15:30 PM".
Here are a few additional things you could check:
Format: Ensure that the date string in dictionaryData("start_date") matches the format "M/d/yyyy h:mm:ss tt" exactly. Even a small discrepancy, like missing leading zeros or AM/PM indicator, can cause this error.
Culture Info: The DateTime.ParseExact method is using System.Globalization.CultureInfo.InvariantCulture, which might not match the culture info of the date string. If the date string is formatted according to a specific culture, you should use that culture info instead.
Null or Empty Value: Check if dictionaryData("start_date") is null or an empty string. Trying to parse a null or empty string will also throw this error.
Thanks,
let me try then your above suggestions.
but below is the output from the panel, which will show you the format of the date retrieved, and what format I want it to be changed to.
You should be parsing the date with this: start_Date = DateTime.ParseExact(dictionaryData("start_date" ).ToString, "MM/dd/yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture)