Java Today getToday()

Here you can find the source of getToday()

Description

get Today

License

Apache License

Declaration

public static String getToday() 

Method Source Code


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

import java.text.SimpleDateFormat;

public class Main {
    static public SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");

    public static String getToday() {
        return getDateStr(new java.util.Date());
    }//from   www .j a v a2s  .c  o  m

    public static String getDateStr(java.util.Date date) {
        if (date == null)
            return "";
        try {
            return yyyyMMdd.format(date);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
}

Related

  1. getToday()
  2. getToday()
  3. getToday()
  4. getToday()
  5. getToday()
  6. getToday()
  7. getToday()
  8. getToday()
  9. getToday()