水晶报表日期公式,使其在月末(Crystal Report Date formula to make

2019-07-30 19:58发布

我是新来的CR和需要一个公式,这将使我一个月的月底日期字段。 如果日期是二千零十二分之六百二十八或2012/7/12我需要的公式是月末问题上没有哪个月份的日场演出。 当然,我们知道,不是每本月30日或31日和二月有时结束29日或30日。 因此,我可以用什么公式来做到这一点

例如字段名{table.end_date}

任何帮助是极大的赞赏。

提前致谢。

Answer 1:

创建一个公式字段来计算月末:

//{@EndOfMonth}
// find the first day of the month, add a month to it, then subtract a day
DateAdd("m", 1, DateTime( Year({table.dateField}), Month({table.dateField}), 1, 0,0,0 )) - 1

创建第二公式,将产生的文本表示:

//{@TextRepresentation}
If Isnull({table.end_date}) Then
  Space(8)
Else
  ToText({@EndOfMonth}, "YYYYMMDD")


文章来源: Crystal Report Date formula to make it the end of the month