Here you can find the source of getDateWithoutTimeZone(Date date)
Parameter | Description |
---|---|
date | The Date to convert to Calendar |
public static Calendar getDateWithoutTimeZone(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**/*from w w w.j av a2s . c om*/ * Returns a Calendar without time zone & time * @param date The Date to convert to Calendar * @return the Calendar */ public static Calendar getDateWithoutTimeZone(Date date) { if (date == null) { return null; } Calendar cal = getCalendarWithoutTimeZone(date); cal.clear(Calendar.ZONE_OFFSET); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; } /** * Returns a Calendar with no time zone * @param date The Date to convert to Calendar * @return the Calendar */ public static Calendar getCalendarWithoutTimeZone(Date date) { if (date == null) { return null; } Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.clear(Calendar.ZONE_OFFSET); return cal; } }