Java Date to String date2String(Date date, String format)

Here you can find the source of date2String(Date date, String format)

Description

date String

License

Apache License

Declaration

public static String date2String(Date date, String format) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
    public static final String DEFAULT_DATE_FORMATE = "yyyyMMddHHmmss";

    public static String date2String(Date date) {
        return getDate2Str(DEFAULT_DATE_FORMATE, date);
    }//w w  w  .j  a  v a  2 s  .  c  o m

    public static String date2String(Date date, String format) {
        return getDate2Str(format, date);
    }

    public static synchronized String getDate2Str(String format, Date date) {
        simpleDateFormat.applyPattern(format);
        return simpleDateFormat.format(date);
    }
}

Related

  1. date2String(Date date)
  2. date2String(Date date, DateFormat dateFormat)
  3. date2String(Date date, int _iType)
  4. Date2String(Date date, String DateFormat)
  5. date2string(Date date, String format)
  6. date2String(Date date, String format)
  7. Date2String(Date date, String formatPattern)
  8. date2String(Date date, String pattern)
  9. date2String(Date source, String formatString)