如何检查某个月是否属于日期间隔? [英] How to check if a month is part of a date interval?
本文介绍了如何检查某个月是否属于日期间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一年内有一系列日期间隔,需要计算覆盖的月数。在一年内。
例如我有间隔1月 - 4月,1月 - 7月,9月 - 12月
是否有可能以某种方式创建一个能够返回正确月数的查询或函数 - 在这种情况下11?
I have a series of date intervals within a year and need to count the number of months "covered" in a year.
E.g. I have the intervals Jan - April, Jan - July, Sept - Dec.
Is it possible somehow to make a query or function that will be able to return the correct number of months - in this case 11?
推荐答案
你不知道信息存储的位置和方式,你的例子表明字符串值没有标准格式,没有年份价值。
如果没有这个明确的解释,它很难帮助。
You don''t say where/how the information is stored, and your example indicates no standard format for the string values and no year values.
Without this clearly explained it''s hard to help.
NeoPa是对的,你没有提供足够的信息详细的回应。但是,如果您的日期格式如此,那么从概念上讲,您将执行以下操作:
NeoPa is right, you don''t provide enough info for a detailed response. However, if your dates are formatted as such then conceptually you''ll do something like this:
< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号
如果再次查看示例数据,您会发现这不是足够的逻辑。在示例数据的情况下,它将产生15。
If you look at the example data again you''ll see that wouldn''t be adequate logic. In the case of the example data it would yield 15.
这篇关于如何检查某个月是否属于日期间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文