Java Time Format getCurDateTime(String formatStr)

Here you can find the source of getCurDateTime(String formatStr)

Description

get Cur Date Time

License

Open Source License

Declaration

public static String getCurDateTime(String formatStr) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static String getCurDateTime() {
        return getCurDateTime(DEFAULT_PATTERN);
    }/*from   w  ww  .j  a va 2s . c o  m*/

    public static String getCurDateTime(String formatStr) {
        SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
        String now = sdf.format(new Date());
        return now;
    }
}

Related

  1. formatTimeZoneID(String id)
  2. formatToTimeStr(String str)
  3. formatUptime(long uptime)
  4. formatVideoRecordingTime(long t)
  5. getCalendarByDateTime(int dateTime, String dateFormat)
  6. getCurDateTimeFormat(String Format)
  7. getCurrDatetimeWithDbFormat()
  8. getCurTime(String dateformat)
  9. getDefaultDatetimeFormat()