Java Time Format getTime(String format)

Here you can find the source of getTime(String format)

Description

get Time

License

Apache License

Declaration

public static String getTime(String format) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static SimpleDateFormat sdf = new SimpleDateFormat();

    public static String getTime(String format) {
        return formatDate(new Date(), format);
    }//from   w w  w .j a  va2s. c  o m

    public static String formatDate(Date date, String formater) {
        sdf.applyPattern(formater);
        return sdf.format(date);
    }
}

Related

  1. getTime(DateFormat df)
  2. getTime(int format)
  3. getTime(long time, int timeFormat)
  4. getTime(String dateStr, String format)
  5. getTime(String dateStr, String formate)
  6. getTime(String format, String date)
  7. getTime(String timeFormat)
  8. getTimeAfter(int field, int amount, String formatStr)
  9. getTimeAsString(final Date date, final String format)