Java Date to String dateToString(Date date)

Here you can find the source of dateToString(Date date)

Description

date To String

License

Open Source License

Declaration

public static String dateToString(Date date) 

Method Source Code

//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;
    }
}

Related

  1. dateToString(Date date)
  2. dateToString(Date date)
  3. dateToString(Date date)
  4. dateToString(Date date)
  5. dateToString(Date date)
  6. dateToString(Date date)
  7. dateToString(Date date)
  8. dateToString(Date date)
  9. dateToString(Date date)