Java Today today()

Here you can find the source of today()

Description

today

License

Open Source License

Declaration

public static Calendar today() 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static Calendar today() {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal;
    }//w  w  w .  j a va 2  s .  com

    public static String today(String pattern) {
        Calendar cal = today();
        return new SimpleDateFormat(pattern).format(cal.getTime());
    }
}

Related

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