Java Time Now getCurTimeStr()

Here you can find the source of getCurTimeStr()

Description

get Cur Time Str

License

Open Source License

Declaration

public static String getCurTimeStr() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    private final static ThreadLocal<SimpleDateFormat> DATE_FORMATER = new ThreadLocal<SimpleDateFormat>() {
        @Override/*from w  w w .  j a v  a2s . co  m*/
        protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        }
    };

    public static String getCurTimeStr() {
        Calendar cal = Calendar.getInstance();
        String curDate = DATE_FORMATER.get().format(cal.getTime());
        return curDate;
    }
}

Related

  1. getCurrDateTime()
  2. getCurrSysTime()
  3. getCurrTime()
  4. getCurrTime()
  5. getCurTime()
  6. getDBCurrentTime()
  7. getLogCurrentTime()
  8. getNow()
  9. getNow()