【问题标题】:Date/time comparison日期/时间比较
【发布时间】:2023-03-08 02:04:01
【问题描述】:

我想找到记录之间的最小日期/时间的日期/时间。在具有多条记录的表中。

效果。

 - 11/11-15 13:00
 - 11/11-15 15:30
 - 11/11-15 16:45 <= (find this record)
 - Timenow (11/11-15 18:33) the current record i want to create but i need to compare the old dates with.

我无法创建逻辑,求助!

谢谢

【问题讨论】:

标签: sql axapta


【解决方案1】:

您可以创建一个返回两个日期之间差异的函数,通过该函数运行所有可能的日期,然后选择最小的差异。

类似这样的东西(伪 c 代码)

 int array[numdates];
 for (int i=0;i<numdates;i++)
     array[i]=compareDates(date[index], currentDate);

然后您可以对数组进行排序,使最小的数字位于开头(或结尾)并返回那个数字。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-20
    • 2012-12-29
    • 2011-04-28
    • 2021-08-17
    • 2018-05-29
    相关资源
    最近更新 更多