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

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

Description

convert To String

License

Open Source License

Declaration

public static String convertToString(Date date, String style) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.TimeZone;

public class Main {

    public static String convertToString(Date date, String style) {

        SimpleDateFormat df = new SimpleDateFormat(style);
        return df.format(date);
    }/*  w ww. jav  a 2s.  co  m*/

    public static String convertToString(Date date, String style, TimeZone tz) {
        SimpleDateFormat df = new SimpleDateFormat(style);
        df.setTimeZone(tz);
        return df.format(date);
    }
}

Related

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