FormatDate function requires 2 arguments of types: (date,text)

kidest

New Member
Hi

I have problem using the format date. Please see first screenshot were the temporary values are "16/09/2019", but when valudating the expression I get an error (FormatDate function requires 2 arguments of types: (date,text)), please see second screenshot.

Best Esben
 

Attachments

  • Screenshot 2019-09-12 at 08.50.06.png
    53 KB · Views: 79
  • Screenshot 2019-09-12 at 08.50.24.png
    70.6 KB · Views: 79

gil.silva

Active Member
Hello kidest,

The problem is that the first argument should be in the format date (or a text which can be converted to date).
A valid date is determined by the format of your computer system.
I believe you have the format MM/dd/YYYY or YYYY/MM/dd and your data item is in the format dd/MM/YYYY (16/09/2019), therefore BP can't convert it to date and proceed with the FormatDate.

Solution: Use a calculation stage with some functions to swap the day with the month and then you can use the FormatDate function.
Expression: Mid([Input], 4, 2) & "/" & Left([Input], 2) & "/" & Right([Input], 4)

The previous expression works to convert to the format MM/dd/YYYY, in other cases, you need to do some modifications.
 

jigibaby1

Member
Hello kidest,

The problem is that the first argument should be in the format date (or a text which can be converted to date).
A valid date is determined by the format of your computer system.
I believe you have the format MM/dd/YYYY or YYYY/MM/dd and your data item is in the format dd/MM/YYYY (16/09/2019), therefore BP can't convert it to date and proceed with the FormatDate.

Solution: Use a calculation stage with some functions to swap the day with the month and then you can use the FormatDate function.
Expression: Mid([Input], 4, 2) & "/" & Left([Input], 2) & "/" & Right([Input], 4)

The previous expression works to convert to the format MM/dd/YYYY, in other cases, you need to do some modifications.
Thanks this solution worked for me
 
Top