PDA

View Full Version : how to return date and time in DateField ?



Atum
21 Jan 2010, 7:05 AM
how to return date and time in DateField ?



public void onModuleLoad() {

DateField df = new DateField();
DateTimePropertyEditor pr = new DateTimePropertyEditor("dd.MM.y HH:mm");
df.setPropertyEditor(pr);
RootPanel.get().add(df);

}
DatePicker return time 15.01.2010 00:00

I want to for example 15.01.2010 18:00

sven
21 Jan 2010, 7:06 AM
A datepicker picks a date. The time gets cleared internly. You will need to write some own DateTimePicker that fits your needs.

Atum
21 Jan 2010, 7:22 AM
df.addListener(Events.Blur, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
DateField date = (DateField) be.getSource();
Date d = date.getValue() ;
Date nd = new Date(d.getTime() + 6*180*60*1000);
date.setValue(nd) ;
}
});

15.01.2010 18:00

:(

Events.Blur increases time



A datepicker picks a date. The time gets cleared internly. You will need to write some own DateTimePicker that fits your needs.

DateTimePicker -> DateTimeMenu-> DateTimeField ?!