views:

37

answers:

1

How can I easily do the following in GWT? (The code below is illegal since String.format is not emulated.)

long lTime = System.currentTimeMillis() % (24*60*60*1000);
long lHour = lTime/(60*60*1000);
long lMin = lTime/(60*1000)%60;
long lSec = lTime/1000%60;
long lMilli = lTime%1000;
return String.format("%d.%.2d:%.2d.%.4d", lHour, lMin, lSec, lMilli);
+2  A: 

You should use Date (yes, most of its methods are deprecated, but that's what the GWT team chose) and DateTimeFormat

Igor Klimer