Tuesday 15 March 2011

sql - Passing formatted date to hsql from Java -


I use the following code to create a date in the hsql database date field to keep it as a date parameter I am Calendar cal = Calendar.getInstance (); Cal.setTime (new date ()); Cal.set (calendar.HOUR_OF_DAY, 0); Cal.set (Calendar minutes, 0); Cal.set (calendar. SECOND, 0); Cal.set (Calendar. MILLISECOND, 0); Cal.add (Calendar: IEER, -1); Date cutoffdate = cal.getTime (); String dateformat = New SimpleDateform ("DD-MMM-Yyy"). Draft (cutoffdate); Querybuilder.append ("and c.contactDt> =: cutoffdate");

But c.ContactDt is the date. I need to pass the date if I pass the value cal.getTime (), then it shows an invalid format. So I need to change the dateFormatter .

I am adding a lot of code to change it, so I think there should be a better way of doing this. Any ideas? Specify a date as hsqldb "DATE ​​yyyy-mm-dd" as

post-text "itemprop =" text ">

Is this formatting you should format it Like "date 1 99-11-11"

No comments:

Post a Comment