比较DB2中的两个日期,以了解它是否与当前日期不同

时间:2022-06-01 16:58:22

I need to compare a date to know if they are a different day from today, one from my database and the other is the current date, but when i get the date it quits a day, month and year still ok but day not.

我需要比较一个日期,以了解它们是否与今天不同,一个来自我的数据库,另一个是当前日期,但是当我得到日期时,它退出一天,一个月和一年仍然可以但不是一天。

var datecheck = result.invocationResult.resultSet[0].CHECKINDATE;
 var d = new Date(datecheck);
 var n = d.getDate();   
 console.log(n); 

![my date in the DB2 looks like this]

![我在DB2中的日期看起来像这样]

CHECKINDATE":2014-08-07T00:00:00.000Z"

1 个解决方案

#1


0  

According to your question you want rows where the date is different from today, in your comment you propose the solution:

根据您的问题,您需要日期与今天不同的行,在您的评论中,您提出了解决方案:

 SELECT * FROM table WHERE MYDATE = CURRENT DATE

Given the formulation of the problem I would expect:

鉴于问题的形成我会期望:

 SELECT * FROM table WHERE MYDATE <> CURRENT_DATE

to be closure to the truth.

关闭真相。

#1


0  

According to your question you want rows where the date is different from today, in your comment you propose the solution:

根据您的问题,您需要日期与今天不同的行,在您的评论中,您提出了解决方案:

 SELECT * FROM table WHERE MYDATE = CURRENT DATE

Given the formulation of the problem I would expect:

鉴于问题的形成我会期望:

 SELECT * FROM table WHERE MYDATE <> CURRENT_DATE

to be closure to the truth.

关闭真相。