Skip to main content
Nintex Community Menu Bar

Hello, 

 

Im relatively new to Nintex, having issues with the following, 

im running a Query that looks at all the items in the lists and compares the date in the column (WF Date) to a variable in the workflow (DATE_Today).

Currently using "add time to date" set date to "use date when action is executed"

When i log i get the value in this format "24/08/2021  3:17:17 PM"

then use a query to compare and get the ""String was not recognized as a valid DateTime." error.

 

i set up a test query to get the WF Date values to look and they are formatted as ""2021-10-24T14:00:00Z"

 

how do i fix this?

is there anyone who can help with this?


Bump??

Parsing a string representation of a c# DateTime is a tricky thing because different cultures have different date formats. .Net is aware of these date formats and pulls them from your current culture (System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat) when you call DateTime.Parse(this.Text); You can either call DateTime.ParseExact and pass in the exact format string that you're expecting, or you can pass in an appropriate culture to DateTime.Parse to parse the date.



 



For example, this will parse your date correctly:



 



DateTime.Parse( "22/11/2009", CultureInfo.CreateSpecificCulture("fr-FR") );



 



Of course, you shouldn't just randomly pick France, but something appropriate to your needs.



 



What you need to figure out is what System.Threading.Thread.CurrentThread.CurrentCulture is set to, and if/why it differs from what you expect. The IFormatProvider parameter specifies the culture to use to parse the date. Unless your string comes from the user, you should pass CultureInfo.InvariantCulture. If the string does come from the user, you should pass CultureInfo.CurrentCulture, which will use the settings that the user specified in Regional Options in Control Panel.



 


Reply