@Override public Date toTimeZone( TimeZone tz ) { Calendar cal = null; if ( tz == null ) { cal = getInstance(); } else { cal = getInstance( tz ); } cal.setTimeInMillis( this.cal.getTimeInMillis() ); return new Date( cal, tz == null ); }
protected PrimitiveValue toDateParticle( Object sqlValue ) { Temporal value = null; if ( sqlValue instanceof java.util.Date ) { Calendar cal = Calendar.getInstance(); cal.setTime( (java.util.Date) sqlValue ); value = new Date( cal, true ); } else if ( sqlValue != null ) { throw new IllegalArgumentException( "Unable to convert SQL result value of type '" + sqlValue.getClass() + "' to Date particle." ); } return new PrimitiveValue( value, pt ); }
@Deprecated public static String formatDate( final java.util.Date date ) { return formatDate( new org.deegree.commons.tom.datetime.Date( date, GMT ) ); }
/** * Parses the given <code>xs:date</code> string. * * @param xsDate * the <code>xs:date</code> to be parsed, must not be <code>null</code> * @return the parsed date, never <code>null</code> (available timezone information is kept) * @throws IllegalArgumentException * if parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for * <code>xs:date</code> */ public static Date parseDate( final String xsDate ) throws IllegalArgumentException { Calendar cal = DatatypeConverter.parseDate( xsDate ); boolean isTimeZoneUnknown = isLocal( xsDate ); return new org.deegree.commons.tom.datetime.Date( cal, isTimeZoneUnknown ); }
Calendar cal = new GregorianCalendar( year, month, day ); PrimitiveType pt = field.propertyType.getPrimitiveType(); PrimitiveValue pv = new PrimitiveValue( new Date( cal, true ), pt ); property = new SimpleProperty( field.propertyType, pv ); break; PrimitiveValue pv = new PrimitiveValue( new Date( cal, true ), pt ); property = new SimpleProperty( field.propertyType, pv ); break;