Java Time Now getStrCurrentStrTime()

Here you can find the source of getStrCurrentStrTime()

Description

get Str Current Str Time

License

Apache License

Declaration

public static String getStrCurrentStrTime() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getStrCurrentStrTime() {
        return getCurrentStrTime("yyyyMMddHHmmss");
    }//from   w  ww.j av  a2 s .  c  om

    public static String getCurrentStrTime() {
        return getCurrentStrTime("yyyy-MM-dd HH:mm:ss");
    }

    public static String getCurrentStrTime(String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Date date = new Date();
        String currentTime = sdf.format(date);

        return currentTime;
    }
}

Related

  1. getNowTime(String formatStr)
  2. getNowWithLocal(boolean ifdatetime)
  3. getNowYearMonth()
  4. getNowYMD()
  5. getSpecifiedDateTime_235959(Date curDate)
  6. getThaiCurrentTime()
  7. getTimeFromCurrent(long l)
  8. getTimeString()
  9. getTimeString()