Here you can find the source of makeDateISO8601(Date date)
public static String makeDateISO8601(Date date)
//package com.java2s; /**//w w w. j av a2 s . c o m * $Id$ * $URL$ * DateUtils.java - genericdao - Sep 16, 2008 11:03:28 PM - azeckoski ************************************************************************** * Copyright (c) 2008 Aaron Zeckoski * Licensed under the Apache License, Version 2.0 * * A copy of the Apache License has been included in this * distribution and is available at: http://www.apache.org/licenses/LICENSE-2.0.txt * * Aaron Zeckoski (azeckoski @ gmail.com) (aaronz @ vt.edu) (aaron @ caret.cam.ac.uk) */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String makeDateISO8601(Date date) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String result = df.format(date); // convert YYYYMMDDTHH:mm:ss+HH00 into YYYYMMDDTHH:mm:ss+HH:00 result = result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2); return result; } }