Java Time Now getNow()

Here you can find the source of getNow()

Description

get Now

License

Apache License

Declaration

public static String getNow() 

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 {
    public static String getNow() {

        return getDate(new Date());
    }/*from  ww  w .j a  va 2  s.c  o  m*/

    public static String getDate(Date date) {
        return format(date, "yyyy-MM-dd");
    }

    public static String format(Date date, String format) {
        String result = "";
        try {
            if (date != null) {
                DateFormat dateFormat = new SimpleDateFormat(format);
                result = dateFormat.format(date);
            }
        } catch (Exception localException) {
        }
        return result;
    }

    public static String format(Date date) {
        return format(date, "yyyy-MM-dd");
    }
}

Related

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