比较两个日期长一个月 [英] compare two dates length one month

查看:119
本文介绍了比较两个日期长一个月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想比较两个日期,如果相差一个月,则显示一个消息框.我找到了compare方法,但只显示了大于等于或小于等于,是否有任何关于如何计算月份中日期差的想法?

Kyriakos

Hello,
I want to compare two dates and if the difference is one month to display a message box. I found the compare method but only shows if it is greater equal or less than, any ideas on how to count the difference of the dates in months?

Kyriakos

推荐答案

使用 ^ ]函数.

作为第一个参数,使用DateInterval.Month(或"m")获取两个日期之间的月份数.如果结果为0,则差异相差不到一个月.
Use the DateDiff[^] function.

As the first parameter use DateInterval.Month (or "m") to get the number of month between the two dates. If the result is 0 than the difference is less than a month.


这篇关于比较两个日期长一个月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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