Java Now getShortNowTime()

Here you can find the source of getShortNowTime()

Description

get Short Now Time

License

Apache License

Declaration

public static String getShortNowTime() 

Method Source Code

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

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

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

    public static String getShortNowTime() {
        return getNowTime(yyyyMMdd);
    }/*w w w  . j  a v a2s  . c  o m*/

    public static String getNowTime() {
        return getNowTime(yyyyMMddHHmmss);
    }

    public static String getNowTime(String format) {
        Date nowDate = new Date();
        Calendar now = Calendar.getInstance();
        now.setTime(nowDate);
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(now.getTime());
    }
}

Related

  1. getAllnowTime()
  2. getDisplayDateNow()
  3. getFormatNowDateTime(String formatStr)
  4. getFormattedDateNow(@Nonnull final String sFormat)
  5. getInviteCodeByNowDate()
  6. getStringNowTime()
  7. getStringOfNowDate(String fFormatStr)
  8. getTimeNow()
  9. getTimeNow(Date theTime)