/* The result is the datetime value built of datevalue and timevalue. */ public static SchemaDateTime datetimeFromDateAndTime( SchemaDate datevalue, SchemaTime timevalue /* optional */) { if (timevalue.hasTimezone() == SchemaCalendarBase.TZ_OFFSET) return new SchemaDateTime( datevalue.getYear(), datevalue.getMonth(), datevalue.getDay(), timevalue.getHour(), timevalue.getMinute(), timevalue.getSecond(), timevalue.getPartSecond(), timevalue.getTimezoneOffset()); SchemaDateTime result = new SchemaDateTime( datevalue.getYear(), datevalue.getMonth(), datevalue.getDay(), timevalue.getHour(), timevalue.getMinute(), timevalue.getSecond(), timevalue.getPartSecond()); result.setTimezone(timevalue.hasTimezone(), 0); return result; }
/* The result is the datetime value consisting of the parts given by year, month, day, hour, minute and second. */ public static SchemaDateTime datetimeFromParts( SchemaTypeNumber year, SchemaTypeNumber month, SchemaTypeNumber day, SchemaTypeNumber hour /* optional */, SchemaTypeNumber minute /* optional */, SchemaTypeNumber second /* optional */, SchemaTypeNumber millisecond /* optional */, SchemaTypeNumber timezone /* optional */) { SchemaDateTime result = new SchemaDateTime( year.intValue(), month.intValue(), day.intValue(), hour.intValue(), minute.intValue(), second.intValue(), 0); result.setMillisecond(millisecond.intValue()); long tv = result.getTimeValue(); result.setTimeFromTimeValue(tv); result.setDateFromTimeValue(tv); if (timezone.intValue() >= -1440 && timezone.intValue() <= 1440) result.setTimezone(SchemaCalendarBase.TZ_OFFSET, timezone.intValue()); return result; }