开发者

GWT time/string formatting

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);
lo开发者_Go百科ng 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);


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜