import java.util.*;
import java.text.*;
+import mir.misc.*;
+
public class DateToMapAdapter extends AbstractMap {
Date date;
public Object get(Object aKey) {
if (aKey instanceof String) {
- return new SimpleDateFormat((String) aKey).format(date);
+ try {
+ // ML: quick fix to allow for the dc encoding now...
+ if (((String) aKey).equals("dc")) {
+ GregorianCalendar calendar = new GregorianCalendar();
+ calendar.setTime(date);
+ return StringUtil.date2w3DateTime(calendar);
+ }
+ else
+ return new SimpleDateFormat((String) aKey).format(date);
+ }
+ catch (Throwable t) {
+ throw new RuntimeException( "Can't format date with format " + (String) aKey + ": " + t.getMessage());
+ }
}
else return null;
}