Crystal 报告将 DateTime 转换为字符串 为该函数提供了太多参数

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

我在 crystal 报告中有一个如下所示的简单公式:

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

{employ.createdDate} 格式如下:

02/09/2015 10:48:25

{employ.createdDate}为null时,它工作正常,但当它不为null时,下面的错误消息显示:

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

删除 "dd-MMM-yyyy" 确实解决了问题,但我想将日期格式化为 "dd-MMM-yyyy" 格式,即 "09-FEB-2015"

公式有什么问题?

哦,我想通了...

02/09/2015 10:48:25是字符串格式的,所以我需要把它转成日期再转成字符串,我把公式改成这样,就可以了:

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

尝试使用这个而不只是 toText

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