Here you can find the source of date2string(Date date)
Parameter | Description |
---|---|
date | Date to convert |
public static String date2string(Date date)
//package com.java2s; /*/*ww w .ja v a 2s .c o m*/ * @copyright 2012 Philip Warner * @license GNU General Public License * * This file is part of Book Catalogue. * * TaskQueue 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. * * TaskQueue 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 Book Catalogue. If not, see <http://www.gnu.org/licenses/>. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** Date format used in displaying and parsing dates in the database */ private static final DateFormat m_stdDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /** * Utility routine to convert a date to a string. * * @param date Date to convert * @return Formatted string */ public static String date2string(Date date) { return m_stdDateFormat.format(date).toString(); } }