[MOBY-dev] Dashboard and date types

Martin Senger martin.senger at gmail.com
Mon May 21 00:57:05 UTC 2007


I have fixed the bug reported by Ivan about the wrong format of date/time
strings produced by jMoby classes. The format, indeed, did not conform with
the http://www.w3.org/TR/NOTE-datetime standard as required by Biomoby API).

But doing it I found some unanswered questions. Perhaps mainly for Paul, but
because the bug was reported here, I am discussing it also here.

The problem was caused mainly by the fact that the java class
SimpleDateFormat (a class that is usually used for creating formatted
strings from the Date objects) produces strings that are not compatible with
the "http://www.w3.org/TR/NOTE-datetime" standard. Or, at least, I have not
found a way how to do it (which is the first question: can it be done?
how?). The lines:

SimpleDateFormat sdf = new SimpleDateFormat (MobyDateTime.FULL_FORMAT);
System.out.println (sdf.format (new Date()));

produces "2007-05-21T00:40:35+0100" which does not comply with he mentioned
standard (the result that complies should be: "2007-05-21T00:40:35+01:00").

But because of using SimpleDateFormat is otherwise very convenient, I have
added a hack into MobyDateTime class that accepts even this non-standard
format and converts it into a good one (by adding a colon separator). Here
is the second question: is there a better place or way to replace this hack?

Last, and actually the main question, is that I suspect a bug in the method
MobyDataDateTime.getString(calendar). When I feed it with the calendar
created from the string "2007-05-21T00:40:35+01:00" I will get a string
"2007-05-21T02:40:35Z". The method removed timezone (and replaced it with a
single Z letter, which is correct) but the time - that should be now in GMT
- is now bigger by two hours when I expected decrease by one hour (moving
from my BST time which is +01 to the GMT). Is this a bug or my
misinterpretation of the times?

Cheers,
Martin

-- 
Martin Senger
   email: martin.senger at gmail.com
   skype: martinsenger



More information about the MOBY-dev mailing list