Here you can find the source of getIso8601String(Date d)
public static String getIso8601String(Date d)
//package com.java2s; /**// w ww. j a v a 2 s. c om * Copyright (c) 2012 Todoroo Inc * * See the file "LICENSE" for the full license governing this code. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ssz"; /** * Format a Date into ISO 8601 Complaint format. * @return date string, or empty string if input was null */ public static String getIso8601String(Date d) { SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT); String result = ""; if (d != null) { result = sdf.format(d); } return result; } }