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

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

Description

convert To String

License

Apache License

Declaration

public static String convertToString(String format, Date date) 

Method Source Code


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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String convertToString(String format, Date date) {
        if (date == null)
            return "";
        SimpleDateFormat df = new SimpleDateFormat(format);
        return df.format(date);
    }//from  w  ww.  j  a  v  a2  s . c o m
}

Related

  1. convertTimeToString(Date date, String pattern)
  2. convertToString(Date date)
  3. ConvertToString(Date date, String format)
  4. convertToString(Date date, String style)
  5. convertToString(java.util.Date date)
  6. date2str(Calendar c)
  7. date2Str(Calendar c, String format)
  8. date2Str(Date aDate)
  9. date2Str(Date date)