Java Today today()

Here you can find the source of today()

Description

today

License

Apache License

Declaration

public static long today() 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static long today() {
        return dayFromDatetime(System.currentTimeMillis());
    }// w ww . ja  v  a2 s  . c o  m

    public static long dayFromDatetime(long datetime) {
        Calendar cal = new java.util.GregorianCalendar();
        cal.setTimeInMillis(datetime);

        // today
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);

        return cal.getTime().getTime();
    }
}

Related

  1. plusDaysToday(int days)
  2. sameTimeToday(Date time)
  3. startOfToday()
  4. today()
  5. Today()
  6. today()
  7. today()
  8. today()
  9. today()