Java Time Format getCurrDatetimeWithDbFormat()

Here you can find the source of getCurrDatetimeWithDbFormat()

Description

get Curr Datetime With Db Format

License

Apache License

Declaration

public static String getCurrDatetimeWithDbFormat() 

Method Source Code


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

import java.text.DateFormat;

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

public class Main {
    private static ThreadLocal<DateFormat> dbDateFormatThreadLocal = new ThreadLocal<DateFormat>() {

        @Override//w w w . ja va 2 s  . c  o  m
        protected DateFormat initialValue() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        }

    };

    public static String getCurrDatetimeWithDbFormat() {
        DateFormat dbDateFormat = dbDateFormatThreadLocal.get();
        return dbDateFormat.format(new Date());
    }
}

Related

  1. formatUptime(long uptime)
  2. formatVideoRecordingTime(long t)
  3. getCalendarByDateTime(int dateTime, String dateFormat)
  4. getCurDateTime(String formatStr)
  5. getCurDateTimeFormat(String Format)
  6. getCurTime(String dateformat)
  7. getDefaultDatetimeFormat()
  8. getDefaultPropertyPageDateTimeFormat()
  9. getEndDate(String time, SimpleDateFormat dateFormat)