Here you can find the source of toIso8601(Date dateTime)
public static String toIso8601(Date dateTime)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** ISO 8601 format for a complete date and time in UTC. */ public static final DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); /** Formats a {@link Date} as an ISO 8601 string in the UTC timezone. */ public static String toIso8601(Date dateTime) { return FORMAT.format(dateTime); }/*from ww w . j ava 2 s . c o m*/ }