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;

import java.util.Date;

public class Main {

    public static String getToday() {
        java.util.Calendar cal = java.util.Calendar.getInstance();
        return new java.text.SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
    }/*from w w  w .  j  ava  2s .c  o m*/

    public static String format(Date date, String pattern) {
        if (date == null) {
            return null;
        }
        SimpleDateFormat sf = new SimpleDateFormat(pattern);
        return sf.format(date);
    }

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

Related

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