Java TimeZone normalizeDate(Date date, TimeZone timeZone)

Here you can find the source of normalizeDate(Date date, TimeZone timeZone)

Description

normalize Date

License

Open Source License

Declaration

public static Date normalizeDate(Date date, TimeZone timeZone) 

Method Source Code


//package com.java2s;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Main {
    public static Date normalizeDate(Date date, TimeZone timeZone) {
        Calendar calendar = new GregorianCalendar(timeZone);
        calendar.setTime(date);//from   w  w w  . j a v a2s  .  c  o m
        calendar.set(Calendar.AM_PM, Calendar.AM);
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
}

Related

  1. getTimeZoneOffset(Date d)
  2. getTimezoneOffsetInHours(Date date)
  3. hasTimeComponent(Date date, TimeZone timeZone)
  4. midnight(Date date, TimeZone tz)
  5. monthOfYear(Date referenceDate, int month, TimeZone timeZone)
  6. startOfNextDay(final Date date, final TimeZone timeZone)
  7. startOfYear(Date referenceDate, TimeZone timeZone)
  8. toEpoch(Date dateTime, String timeZone)