Here you can find the source of dateToW3CDTF(Date date)
public static String dateToW3CDTF(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String dateToW3CDTF(Date date) { SimpleDateFormat w3cdtf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ"); String s = w3cdtf.format(date); int index = s.length() - 2; return s.substring(0, index) + ":" + s.substring(index); }/*from www. ja v a 2 s . c o m*/ }