Java Hour Format formatInternal(final Date date)

Here you can find the source of formatInternal(final Date date)

Description

Formats a date to use for internal purposes (logging, toString)

License

Open Source License

Parameter

Parameter Description
date the date to be converted

Return

the textual representation (a null date will result in "N/A")

Declaration

public static String formatInternal(final Date date) 

Method Source Code

//package com.java2s;
/**/*from   w w w.  j  a  va 2 s.  co m*/
 * DSS - Digital Signature Services
 * Copyright (C) 2015 European Commission, provided under the CEF programme
 *
 * This file is part of the "DSS - Digital Signature Services" project.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";

    /**
     * Formats a date to use for internal purposes (logging, toString)
     *
     * @param date
     *            the date to be converted
     * @return the textual representation (a null date will result in "N/A")
     */
    public static String formatInternal(final Date date) {
        final String formatedDate = (date == null) ? "N/A"
                : new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT).format(date);
        return formatedDate;
    }
}

Related

  1. formatHttpDate(Date date)
  2. formatHttpDate(Date date)
  3. formatHTTPDate(Date date)
  4. formatHTTPDate(Date pTime)
  5. formatInfo(String info)
  6. formatInterval(long intervalMsec)
  7. formatLastModified(long lastModifiedTime)
  8. formatMessage(String message)
  9. formatMM(Date date)