Here you can find the source of dateToString(Date date)
public static String dateToString(Date date)
//package com.java2s; /**/*from ww w .j av a 2 s . co m*/ * This file is part of SIMPL4(http://simpl4.org). * * Copyright [2014] [Manfred Sattler] <manfred@ms123.org> * * SIMPL4 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SIMPL4 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SIMPL4. If not, see <http://www.gnu.org/licenses/>. */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static String m_datePattern = "dd.MM.yyyy HH:mm"; public static String dateToString(Date date) { String dateString = null; if (date != null) { // dateString = longDateFormat.format(date); SimpleDateFormat sdf = new SimpleDateFormat(m_datePattern); sdf.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); dateString = sdf.format(date); } return dateString; } }