Java Date Format formatDashedDateDDMMYYYY(Date date)

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

Description

Formats the specified date as dd-MM-yyyy.

License

MIT License

Parameter

Parameter Description
date a date to format.

Return

the formatted date.

Declaration

public static String formatDashedDateDDMMYYYY(Date date) 

Method Source Code

//package com.java2s;
/*//from  w ww . j a  v  a 2 s . c  om
 * Copyright (c) 2015-2016 QuartzDesk.com.
 * Licensed under the MIT license (https://opensource.org/licenses/MIT).
 */

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.TimeZone;

public class Main {
    private static final String DATE_FORMAT_DASHED_DD_MM_YYYY = "dd-MM-yyyy";

    /**
     * Formats the specified date as dd-MM-yyyy.
     *
     * @param date a date to format.
     * @return the formatted date.
     */
    public static String formatDashedDateDDMMYYYY(Date date) {
        SimpleDateFormat f = new SimpleDateFormat(DATE_FORMAT_DASHED_DD_MM_YYYY);
        f.setTimeZone(TimeZone.getDefault());
        return f.format(date);
    }
}

Related

  1. dateTimeFormatterDate(Date date)
  2. dateTimeToMillis(String dateTime, String format)
  3. dateTimeToStr(Date date, String format)
  4. dateTimeToZuluFormat(DateTime dateTime)
  5. formatD(Date date)
  6. formatDate(ArrayList list)
  7. formatDate(Date _date)
  8. formatDate(Date aDate)
  9. formatDate(Date d)