/** * This constructor is used to convert a java.util.Date into a new org.exolab.castor.types.Date. * <p> * Note : all the information concerning the time part of the java.util.Date is lost since a W3C * Schema Date only represents CCYY-MM-YY. * * @param dateRef the java.util.Date to use to construct a new org.exolab.castor.types.Date */ public Date(java.util.Date dateRef) { GregorianCalendar tempCalendar = new GregorianCalendar(); tempCalendar.setTime(dateRef); setCentury((short) (tempCalendar.get(Calendar.YEAR) / 100)); setYear((short) (tempCalendar.get(Calendar.YEAR) % 100)); // we need to add 1 to the Month value returned by GregorianCalendar // because 0<MONTH<11 (i.e January is 0) setMonth((short) (tempCalendar.get(Calendar.MONTH) + 1)); setDay((short) tempCalendar.get(Calendar.DAY_OF_MONTH)); } // Date(java.util.Date)
/** * This constructor is used to convert a java.util.Date into a new * org.exolab.castor.types.Date. * <p> * Note : all the information concerning the time part of the java.util.Date * is lost since a W3C Schema Date only represents CCYY-MM-YY. * * @param dateRef * the java.util.Date to use to construct a new * org.exolab.castor.types.Date */ public Date(java.util.Date dateRef) { GregorianCalendar tempCalendar = new GregorianCalendar(); tempCalendar.setTime(dateRef); setCentury((short) (tempCalendar.get(Calendar.YEAR) / 100)); setYear((short) (tempCalendar.get(Calendar.YEAR) % 100)); //we need to add 1 to the Month value returned by GregorianCalendar //because 0<MONTH<11 (i.e January is 0) setMonth((short) (tempCalendar.get(Calendar.MONTH) + 1)); setDay((short) tempCalendar.get(Calendar.DAY_OF_MONTH)); } //Date(java.util.Date)
result.setDay(value1);
result.setDay(value1);
/** * Sets all the fields by reading the values in an array. * <p> * If a Time Zone is specified, it has to be set by using * {@link DateTimeBase#setZone(short, short) setZone}. * * @param values an array of shorts with the values the array is supposed to be of length 4 and * ordered like the following: * <ul> * <li>century</li> * <li>year</li> * <li>month</li> * <li>day</li> * </ul> */ public void setValues(short[] values) { if (values.length != 4) { throw new IllegalArgumentException("Date#setValues: not the right number of values"); } this.setCentury(values[0]); this.setYear(values[1]); this.setMonth(values[2]); this.setDay(values[3]); }
/** * Sets all the fields by reading the values in an array. * <p> * If a Time Zone is specified, it has to be set by using * {@link DateTimeBase#setZone(short, short) setZone}. * * @param values * an array of shorts with the values the array is supposed to be * of length 4 and ordered like the following: * <ul> * <li>century</li> * <li>year</li> * <li>month</li> * <li>day</li> * </ul> */ public void setValues(short[] values) { if (values.length != 4) { throw new IllegalArgumentException("Date#setValues: not the right number of values"); } this.setCentury(values[0]); this.setYear(values[1]); this.setMonth(values[2]); this.setDay(values[3]); }
dateTarget.setYear(temp.getYear()); dateTarget.setMonth(temp.getMonth()); dateTarget.setDay(temp.getDay()); if (temp.isUTC()) { dateTarget.setUTC();
dateTarget.setYear(temp.getYear()); dateTarget.setMonth(temp.getMonth()); dateTarget.setDay(temp.getDay()); if (temp.isUTC()) { dateTarget.setUTC();