unfortunately, there is no formatter, I'd also would be happy if there was one. but you can make a helper function which formats numbers with padding zeros:
String fn(int num, int pads) { if(num>=10)return Integer.toString(num); char[] z; for(z= new char[pads], int i=0; i<z.length; i++) z[i]='0'; return "" + new String(z) + Integer.toString(num); } and then: { String str = ""+fn(0,4)+" "+fn(9,1) + " " + fn(12); //would result i n "0000 09 12" } ok, its ugly, but does the job On 16 Feb., 05:43, Magnus <alpineblas...@googlemail.com> wrote: > Hi, > > I have to explain my real problem with DateFormat: > > I need to represent a time span (the time elapsed during a chess > move), not a real date, e. g.: > > 0000-01-02 03:04:05 > > means: > 0 years, 1 month, 2 days, 3 hours, 4 minutes and 5 seconds. > > Such a span is computed by subtracting a date from another date and > stored as a date: > > Date d1,d2; > .. > long t1 = d1.getTime (); > long t2 = d2.getTime (); > long t = t2 - t1; > Date d = new Date (t); > > I cannot format d it with DateFormat, since it is interpreted as an > offset to 1970. If I could supress this interpretation, I would be > glad. > > As a workaround, I extracted the date elements as integers and tried > to format them with String.format. > > Magnus -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.