Java TimeUnit Usage dateStart(final Calendar c)

Here you can find the source of dateStart(final Calendar c)

Description

date Start

License

Apache License

Declaration

public static Calendar dateStart(final Calendar c) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

import java.util.concurrent.TimeUnit;

public class Main {
    public static final long SECOND = TimeUnit.SECONDS.toMillis(1);
    public static final long MINUTE = TimeUnit.MINUTES.toMillis(1);

    public static Calendar dateStart(final Calendar c) {
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c;
    }//from  w  w w  . j  av  a 2 s  . c o m

    public static long dateStart(final Date date) {
        final Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTimeInMillis();
    }
}

Related

  1. convertNanoToSeconds(long nanoTime)
  2. createTimeString(int year, int month, int day, int hours, int minutes, int seconds, String timezoneID)
  3. createTimezoneString(String timezoneID)
  4. currentMillisFromNanotime()
  5. dateDiff(Date d1, Date d2)
  6. daysBetween(Calendar startDate, Calendar endDate)
  7. daysBetween(Date initDate, Date endDate)
  8. daysBetweenDates(long toDate, long fromDate)
  9. daysFromToday(long toDate)