Timestamp
Hi,
How can I returnonly the date without the time?
publicstatic Timestamp newDate(){
returnnew Timestamp(new Date().getTime());
}
Hi,
How can I returnonly the date without the time?
publicstatic Timestamp newDate(){
returnnew Timestamp(new Date().getTime());
}
public static java.sql.Date newDate() {
return new java.sql.Date(new java.util.Date().getTime());
}
Like this?
public static Timestamp newDate() {
Date date = new Date();
Calendar cal = new GregorianCalendar();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return new Timestamp(cal.getTime().getTime());
// return new Timestamp(new Date().getTime());
}
But, I stuil have a problem:
My goal is to move the houers from the datepicker to get only the date. this give my "today", I want to leave the day that selected without the time
GregorianCalendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
myDatePicker.setDate(cal.getTime());
Maybe something like:
myDatePicker.getDate().setHours(0);
myDatePicker.getDate().setMinutes(0);
myDatePicker.getDate().setSeconds(0);
Message was edited by:
yael800