Java Date to String date2Str(SimpleDateFormat date_sdf)

Here you can find the source of date2Str(SimpleDateFormat date_sdf)

Description

date Str

License

Apache License

Declaration

public static String date2Str(SimpleDateFormat date_sdf) 

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 date2Str(SimpleDateFormat date_sdf) {
        Date date = getDate();/*from  w w  w. j  a  v a 2  s  . c  o m*/
        if (null == date) {
            return null;
        }
        return date_sdf.format(date);
    }

    public static String date2Str(Date date, SimpleDateFormat date_sdf) {
        if (null == date) {
            return null;
        }
        return date_sdf.format(date);
    }

    public static Date getDate() {
        return new Date();
    }

    public static Date getDate(long millis) {
        return new Date(millis);
    }

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

Related

  1. date2Str(Date date, String format)
  2. date2Str(Date date, String partten)
  3. date2Str(Date date, String pattern)
  4. date2Str(Date value)
  5. date2Str(final Date date, final String dateFormat)
  6. date2string(Date _aDate)
  7. date2string(Date date)
  8. date2String(Date date)
  9. date2String(Date date)