gpt4 book ai didi

wolfram-mathematica - 选择 SQLDateTimes 范围

转载 作者:行者123 更新时间:2023-12-01 05:13:47 27 4
gpt4 key购买 nike

table = {{ID1, SQLDateTime[{1978, 1, 10, 0, 0, 0.`}]}, 
{ID2, SQLDateTime[{1999, 1, 10, 0, 0, 0.`}]},
{ID3, SQLDateTime[{2010, 9, 10, 0, 0, 0.`}]},
{ID4, SQLDateTime[{2011, 1, 10, 0, 0, 0.`}]}}

我想返回 table 中 SQLDateTime 在去年的所有情况(DatePlus[{-1, "Year"}])。如何指定对这些案例的搜索?

最佳答案

你也可以使用 DateDifference:

Cases[table, {a_, SQLDateTime[b_]} /; 
DateDifference[b, DateList[], "Year"][[1]] <= 1]

关于wolfram-mathematica - 选择 SQLDateTimes 范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6986546/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com