formate date - month and day problem

I run a scheduled site workflow that will loop through the list. As part of the loop I'll use a query list action and read out the date into a work flow variable. This variable is used in a notification mail where I use the inline FormatDate function to present the date as dd-MM-yyyy.

My problem is, that the date is actually formatted the other way around.

So 8th of September should come out as 08-09-2014 (day-month-year). But it's formatted as 09-08-2014 (month-day-year).

If I have a date in my list that is 20th of April is should come out as 20-04-2014. But with this date the function fails resulting in an output like

fn-FormateDate(20-04-2014 00:00, dd-MM-yyyy)

It makes sense that it fails if it deals with the date as month = 20 since only 12 months are available.

I suspect that the problem comes from reading the date in the query list action. Here the date is read into a workflow variable. I suspect that the day is read as month and month is read as day. But I don't know how to overcome this problem.

Have you tried to store the date using the Nintex Date Calculation function instead of using normal variables? I have had this problem before what I did is to store the first date using the Date Calculation function and then I can format the date to any format after that. Since you are using a query list I guess the date you are reading is from a list. My suggestion is:

First ensure that your site regional settings is correct - your locale etc;

First thing in your loop is set the date variable using calculate date function (see image below);

Then set your string variable and use your format date function;

Just becareful if there is a chance that your date can be null it's best to use a function to get year out and if year is 0001 you know that date field is empty and you don't do the calculated date function because I believe it fails when there is no date.

Have you tried to store the date using the Nintex Date Calculation function instead of using normal variables? I have had this problem before what I did is to store the first date using the Date Calculation function and then I can format the date to any format after that. Since you are using a query list I guess the date you are reading is from a list. My suggestion is:

First ensure that your site regional settings is correct - your locale etc;

First thing in your loop is set the date variable using calculate date function (see image below);

Then set your string variable and use your format date function;

Just becareful if there is a chance that your date can be null it's best to use a function to get year out and if year is 0001 you know that date field is empty and you don't do the calculated date function because I believe it fails when there is no date.