luize casaretti wrote:I tried also with setDate() passing a Date as params, but it didn't work also.
Campbell Ritchie wrote:What number were you passing for month? Remember that 11 means December.
Campbell Ritchie wrote:But Date has 0‑based month numbers. Why are we stuck with java.sql.Date following that convention?
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Tim Holloway wrote:f you want a type-safe month, you use the Calendar month.
luize casaretti wrote:but this new java.sql.Date(DateUtils.parseDate(formatDate, "ddMMyyyy").getTime() still returns yyyyMMdd
Note 1: The third field ('18-04-2024) is a DATE in SQL.
Paul Clapham wrote:A java.sql.Date object doesn't have a format. ...
The documentation wrote:public static Date valueOf(String s)
Converts a string in JDBC date escape format to a Date value.
Parameters:
s - a String object representing a date in in the format "yyyy-[m]m-[d]d". The leading zero for mm and dd may also be omitted.
Returns:
a java.sql.Date object representing the given date
Throws:
IllegalArgumentException - if the date given is not in the JDBC date escape format (yyyy-[m]m-[d]d)
Consider Paul's rocket mass heater. |