Java Time Format getStrDateByFormat(Date time, String format)

Here you can find the source of getStrDateByFormat(Date time, String format)

Description

get Str Date By Format

License

Open Source License

Declaration

public static String getStrDateByFormat(Date time, String format) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getStrDateByFormat(Date time, String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        if (time == null) {
            return "";
        }/*from w  w  w. j ava 2 s .c  o m*/

        if (format == null || format.equals("")) {
            return dateFormat.format(time);
        } else {
            SimpleDateFormat f = new SimpleDateFormat(format);
            return f.format(time);
        }
    }
}

Related

  1. getFullTime(String format, Date date)
  2. getGenerationTime(String format)
  3. getIntegerDateTime(Date date, String dateFormat)
  4. getShowTime(Date date, String format)
  5. getStartTimeFormatter()
  6. getStrDateTime()
  7. getStringFormatFromDateTime(long pDateTime, String format)
  8. getStringFromTime(Date time, String format)
  9. getSysDateTimeForFileName()