Java Time Format getTime(int format)

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

Description

get Time

License

Apache License

Declaration

public static String getTime(int format) 

Method Source Code

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

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

public class Main {
    private static final SimpleDateFormat FORMAT4NAME = new SimpleDateFormat("yyyyMMddHHmmss");
    private static final SimpleDateFormat FORMAT4LOG = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String getTime(int format) {
        if (format == 0) {
            return FORMAT4NAME.format(new Date());
        } else {//from  www . j ava  2s.  co m
            return FORMAT4LOG.format(new Date());
        }
    }
}

Related

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