Java Time Format getTime(DateFormat df)

Here you can find the source of getTime(DateFormat df)

Description

get Time

License

Open Source License

Declaration

public static String getTime(DateFormat df) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static final DateFormat standard = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");

    public static String getTime() {
        return standard.format(new Date());
    }/*ww w  .j a v  a  2  s .  c om*/

    public static String getTime(DateFormat df) {
        return df.format(new Date());
    }

    public static String getTime(Date date, DateFormat df) {
        return df.format(date);
    }

    public static String getTime(long time) {
        return standard.format(new Date(time));
    }
}

Related

  1. getSysDateTimeForFileName()
  2. getSysTimeYMDHMS2()
  3. getTime(@Nonnull String format, @Nonnull String date, @Nonnull String tz)
  4. getTime(Date dt, String format)
  5. getTime(Date time, int format, Locale locale)
  6. getTime(int format)
  7. getTime(long time, int timeFormat)
  8. getTime(String dateStr, String format)
  9. getTime(String dateStr, String formate)