GregorianCalendar cal = new GregorianCalendar(new Locale("sv", "SE"));
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String tmpTime = formatter.format(cal.getTime());
tmpTime = tmpTime.replaceAll("\\+0000$", "Z");
tmpTime = tmpTime.replaceAll("(\\d\\d)$", ":$1");
Things that zoom. Usually this is just notes to my self about problems and solutions I've encountered when programming in java. On really fine days the guest bloggers write something here.
2009-11-27
get an iso-8601 string in Java
Upplagd av
Zoom
kl.
Friday, November 27, 2009
Will they ever get it right. The Date handling in Java is a funny story but here is one way to get an ISO-8601 compatible date/time string.
Subscribe to:
Post Comments (Atom)
4 kommentarer: