User2012384
User2012384

Reputation: 4919

Crystal report converting DateTime to string Too many arguments have been given to this function

I have a simple formula like below in crystal report:

iif(isnull({employ.createdDate}),"", ToText({employ.createdDate}, "dd-MMM-yyyy"))

The {employ.createdDate} is in below format:

02/09/2015 10:48:25

It works fine when {employ.createdDate} is null, but when it's not null, the below error message shows:

  Too many arguments have been given to this function 
  Error in File employeeInfo.rpt: 
  Error in formula txtDate

Removing the "dd-MMM-yyyy" does solve the problem but I would like to format the date to "dd-MMM-yyyy" format i.e. "09-FEB-2015"

What's wrong with the formula?

Upvotes: 0

Views: 6872

Answers (2)

VB1
VB1

Reputation: 214

Try using this instead of just toText

iif(isnull({employ.createdDate}),"", ToText(cDate({employ.createdDate}),"dd-MMM-yyyy"))

Upvotes: 2

User2012384
User2012384

Reputation: 4919

Oh I figured it out...

The 02/09/2015 10:48:25 is in string format, so I need to convert it to date and convert it to string, I modified the formula to this, and it works:

ToText(cDate({employ.createdDate}),"dd-MMM-yyyy")

Upvotes: 4

Related Questions