Java Date to String convertTimeToString(Date date, String pattern)

Here you can find the source of convertTimeToString(Date date, String pattern)

Description

convert Time To String

License

Open Source License

Declaration

public static String convertTimeToString(Date date, String pattern) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static String convertTimeToString(Date date) {
        return convertTimeToString(date, DEFAULT_DATE_FORMAT);
    }/*ww w .ja  v a  2  s  . c om*/

    public static String convertTimeToString(Date date, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }
}

Related

  1. convertDateToString(java.util.Date dt, String pattern)
  2. convertDateToString(String dateFormat, Date date)
  3. convertDateToString(String mask, Date date)
  4. convertDateToURLFormat(final String dateToBeConvert)
  5. convertStringoXSDString(Date date)
  6. convertToString(Date date)
  7. ConvertToString(Date date, String format)
  8. convertToString(Date date, String style)
  9. convertToString(java.util.Date date)