Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Date truncateDate(Date date)
- {
- GregorianCalendar cal = getGregorianCalendar();
- cal.set(Calendar.ZONE_OFFSET, 0); // UTC
- cal.set(Calendar.DST_OFFSET, 0); // We don't want DST to get in the way.
- cal.setTime(date);
- cal.set(Calendar.MILLISECOND, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.HOUR, 0);
- cal.set(Calendar.AM_PM, Calendar.AM);
- return cal.getTime();
- }
- INSERT INTO time_table(dt) VALUES('2008-12-31')
Add Comment
Please, Sign In to add comment