gpt4 book ai didi

date - Crystal 报表日期公式,使其成为月末

转载 作者:行者123 更新时间:2023-12-04 18:15:23 26 4
gpt4 key购买 nike

我是 CR 的新手,需要一个公式,可以在日期字段上为我提供月末 a。
如果日期是 628/2012 或 7/12/2012,无论该字段显示月份中的哪一天,我都需要将公式作为月末。当然,我们知道并非每个月都在 30 日或 31 日结束,2 月有时会在 29 日或 30 日结束。那么我可以使用什么公式来做到这一点

示例字段名称 {table.end_date}

任何帮助是极大的赞赏。

提前致谢。

最佳答案

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

//{@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")

关于date - Crystal 报表日期公式,使其成为月末,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11837372/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com