PDA

View Full Version : getting time from Date



ghatfan99
10 Aug 2010, 3:51 AM
hello every one:
my problem is that i want to get the time in this forma "hh:mm:ss" from a date to put it in:


TextFieldMask fTime = new TextFieldMask(
"99:99:99");
fTime.setFieldLabel("Time, hh:mm:ss");
right.add(fTime, formData);

i tried with:


Date currentDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
com.google.gwt.user.client.Window.alert("time: " + sdf.format(currentDate));

but i have a problem with the import java.text
thank's

ghatfan99
10 Aug 2010, 7:36 AM
sorry but i found the response:



Date currentDate = new Date();
DateTimeFormat.getFormat("hh:mm").format(currentDate);

and the result like "09:37"
but i still have the problem that i can't put the answer in my field TextFieldMask fTime :


fTime.setValue(DateTimeFormat.getFormat("hh:mm").format(currentDate));

the field still empty and i haven't an error message.
thank's

sven
11 Aug 2010, 2:46 AM
I dont fully understand what you are doing. Can you please post some fully working testcase that implements EntryPOint and shows exactly what you have and also explain how it should be.