计算并显示特定日期值

由于“日期”值存储为双精度数,因此当您试图在表达式中使用“日期”值时,可能会得到格式不正确的结果。 本主题说明如何创建表达式和自定义函数,以显示特定日期并计算时间间隔。

当前月

DateSerial(Year(Date()), Month(Date()), 1)

下月

DateSerial(Year(Date()), Month(Date()) + 1, 1)

当月的最后一天
DateSerial(Year(Date()), Month(Date()) + 1, 0)


下个月的最后一天
DateSerial(Year(Date()), Month(Date()) + 2, 0)


上个月的第一天
DateSerial(Year(Date()), Month(Date())-1,1)


上个月的最后一天
DateSerial(Year(Date()), Month(Date()),0)


本季度的第一天
DateSerial(Year(Date()), Int((Month(Date()) – 1) / 3) * 3 + 1, 1)


本季度的最后一天
DateSerial(Year(Date()), Int((Month(Date()) – 1) / 3) * 3 + 4, 0)


假设星期日 = 第 1 天 (一周的第一天)
Date() – WeekDay(Date()) + 1


本周的最后一天
Date() – WeekDay(Date()) + 7

阅读原文:
http://www.accessoft.com/article-show.asp?id=19985

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐