水晶报表日期公式,使其成为月末 [英] Crystal Report Date formula to make it the end of the month

查看:18
本文介绍了水晶报表日期公式,使其成为月末的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm new to CR and need a formula that would give me the end of the month a on a date field. If the Date is 628/2012 or 7/12/2012 I need the formula to to be the end of the month no matter which day of the month the field shows. Of course we know that not every month ends on the 30th or 31th and February sometimes 29th or 30th. So what formula can I use to do this

示例字段名称 {table.end_date}

Example field name {table.end_date}

非常感谢任何帮助.

提前致谢.

推荐答案

创建公式字段计算月末:

Create a formula field to calculate the end of the month:

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

创建将生成文本表示的第二个公式:

Create a second formula that will generate a textual representation:

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

这篇关于水晶报表日期公式,使其成为月末的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆