【发布时间】:2026-02-10 00:10:02
【问题描述】:
我收到以下代码错误:
Date todayDate = new Date();
SimpleDateFormat dataDateFmt = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dataTimeFmt = new SimpleDateFormat("HHmmss");
java.sql.Date nowDate = java.sql.Date.valueOf(dataDateFmt.format(todayDate));
selectFrom = DSL.using(connection)
.select(Msg.MSG.MSGKEY, Msg.MSG.MSGSTS, Msg.MSG.MSGTIT,
DSL.concat(Msg.MSG.MSGTXT1, Msg.MSG.MSGTXT2, Msg.MSG.MSGTXT3),
DSL.date(Msg.MSG.MSGCDAT), Msg.MSG.MSGCTIM,
DSL.date(Msg.MSG.MSGRDAT), DSL.date(Msg.MSG.MSGEDAT),
Msg.MSG.MSGLUID)
.from(Msg.MSG)
.where(Msg.MSG.MSGFID.equal("SYS")
.and(Msg.MSG.MSGSTS.equal("NEW"))
.and(Msg.MSG.MSGTYP.equal("WEBF"))
.and(Msg.MSG.MSGGRP.equal("ALL"))
.and(Msg.MSG.MSGSDAT.lt(nowDate)));
我在最后一行得到的错误是“类型字段中的方法 lt(Timestamp) 不适用于参数 (Date)”。我正在做的事情与我看到的 here 非常相似。
【问题讨论】: