按 6 周持续时间过滤,本周开始你好 -
我有兴趣根据现在到 6 周之间的数据时间戳过滤数据,从一周的第一天(星期日)开始。 当新的一年开始时,这需要额外的逻辑。
我寻找日期时间函数并注意到日期增量功能将提供 6 周的未来。 如何获得过去 6 周的开始日期?
谢谢!
视窗回复:按 6 周持续时间过滤,本周开始这是一个小脚本,可以为您提供解决 6 周问题的指针。

Names Default To Here( 1 );
// put in any date using the format of mm/dd/yyyy
inDate = "07/21/2021";
jmpDate = Informat( inDate, "mm/dd/yyyy" );
// Calculate the date 6 weeks before, and adjust to the
// Sunday prior to the absolute 6 week date
sixWeeksBefore = jmpDate - In Weeks( 6 ) - In Days( Day Of Week( jmpDate ) - 1 );
// Calculate the date 6 weeks after, and adjust to the
// Sunday following
sixWeeksAfter = jmpDate + In Weeks( 6 ) + In Days( 8 - Day Of Week( jmpDate ) );
Dialog(
"Input date is: " || Long Date( jmpDate ),
"6 weeks before is: " || Long Date( sixWeeksBefore ),
"6 weeks after is: " || Long Date( sixWeeksAfter )
);
查看脚本索引以获取有关不同功能的帮助。