Here you can find the source of dateToString(Date date)
public static String dateToString(Date date)
//package com.java2s; /*/*from w w w.j a v a 2 s. c om*/ * Hibernate Search, full-text search for your domain model * * License: GNU Lesser General Public License (LGPL), version 2.1 or later * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import javax.xml.bind.DatatypeConverter; public class Main { private static final TimeZone ENCODING_TIME_ZONE = TimeZone .getTimeZone("UTC"); public static String dateToString(Date date) { Calendar c = Calendar.getInstance(ENCODING_TIME_ZONE, Locale.ENGLISH); c.setTime(date); return DatatypeConverter.printDateTime(c); } }