I am trying to use a java.util.Date as input and then creating a query with it - so I need a java.sql.Date.
I was surprised to find that it couldn\'t do the conver
I think the best way to convert is:
static java.sql.Timestamp SQLDateTime(Long utilDate) {
return new java.sql.Timestamp(utilDate);
}
Date date = new Date();
java.sql.Timestamp dt = SQLDateTime(date.getTime());
If you want to insert the dt
variable into an SQL table you can do:
insert into table (expireAt) values ('"+dt+"');