Java Calendar Calculate normalize(final Calendar cal)

Here you can find the source of normalize(final Calendar cal)

Description

Normalizes a date to be comparable with another date, fixed at 12 hours, 0 seconds, 0 minutes of the day GMT+0.

License

Open Source License

Declaration

public static void normalize(final Calendar cal) 

Method Source Code

//package com.java2s;
/*//from   w w  w.  j  ava2s.  c  om
 * Copyright 2011 - 2012
 * All rights reserved. License and terms according to LICENSE.txt file.
 * The LICENSE.txt file and this header must be included or referenced 
 * in each piece of code derived from this project.
 */

import java.util.*;

public class Main {
    /**
     * Normalizes a date to be comparable with another date,
     * fixed at 12 hours, 0 seconds, 0 minutes of the day GMT+0.
     */
    public static void normalize(final Calendar cal) {
        cal.set(Calendar.HOUR_OF_DAY, 12);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        cal.setTimeZone(TimeZone.getTimeZone("GMT+0"));
    }
}

Related

  1. isInWorkTime(Calendar start)
  2. isSameInstant(Calendar cal1, Calendar cal2)
  3. isSameLocalTime(Calendar cal1, Calendar cal2)
  4. maximizeTime(Calendar cal)
  5. millisToCalendar(long millis)
  6. normalizedClone(final Calendar cal)
  7. postpone(final Calendar calendar, final int measureUnit, final int amount)
  8. resetCalendarTime(Calendar calendar)
  9. roundBack(Calendar start)