if ( date != null && this.inputMode == TIME) {        if ( date.getTime() > 86400000 ) { if (this.calendar == null) { this.calendar = Calendar.getInstance(); this.calendar.setTimeZone(this.timeZone); } this.calendar.setTime(date); long timeOnly = this.calendar.get( Calendar.MILLISECOND ) + this.calendar.get( Calendar.SECOND ) * 1000 + this.calendar.get( Calendar.MINUTE ) * 60 * 1000 + this.calendar.get( Calendar.HOUR ) * 60 * 60 * 1000; date.setTime(timeOnly);    } }
	public void setDate( Date date)	{		this.date = date;		//#if ! tmp.directInput		if (this.midpDateField != null) {			this.midpDateField.setDate( date );		}		//#endif		// set date:		if (date == null ) {			if (this.inputMode == DATE) {				//#if polish.DateFormatEmptyText:defined					//#= this.text = "${polish.DateFormatEmptyText}";				//#elif polish.DateFormat == us || polish.DateFormat == mdy					this.text = "MM-DD-YYYY";				//#elif polish.DateFormat == de					this.text = "TT.MM.JJJJ";				//#elif polish.DateFormat == fr					this.text = "JJ/MM/AAAA";				//#elif polish.DateFormat == dmy					this.text = "DD-MM-YYYY";				//#else					// default to ymd					this.text = "YYYY-MM-DD";				//#endif			} else if (this.inputMode == TIME) {				this.text = "hh:mm";			} else {				//#if polish.DateFormatEmptyText:defined					//#= this.text = "${polish.DateFormatEmptyText} hh:mm";				//#elif polish.DateFormat == us || polish.DateFormat == mdy					this.text = "MM-DD-YYYY hh:mm";				//#elif polish.DateFormat == de					this.text = "TT.MM.JJJJ hh:mm";				//#elif polish.DateFormat == fr					this.text = "JJ/MM/AAAA hh:mm";				//#elif polish.DateFormat == dmy					this.text = "DD-MM-YYYY hh:mm";				//#else					// default to ymd					this.text = "YYYY-MM-DD hh:mm";								//#endif			}		} else {			if (this.calendar == null) {				this.calendar = Calendar.getInstance();				this.calendar.setTimeZone(this.timeZone);			}			this.calendar.setTime(date);			StringBuffer buffer = new StringBuffer(10);			if ((this.inputMode == DATE) || (this.inputMode == DATE_TIME)) {				int year = this.calendar.get(Calendar.YEAR);				int month = this.calendar.get( Calendar.MONTH );				int day = this.calendar.get( Calendar.DAY_OF_MONTH );				//#if polish.DateFormat == us					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )				          .append("-");					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day )						  .append("-");					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year );				//#elif polish.DateFormat == de					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day )						  .append(".");					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )				          .append(".");					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year );				//#elif polish.DateFormat == fr					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day )						.append("/");					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )					    .append("/");					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year );				//#elif polish.DateFormat == mdy					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year );				//#elif polish.DateFormat == dmy					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year );				//#else					// default to YMD					if (year < 10) {						buffer.append( "000");					} else if (year < 100) {						buffer.append( "00");					} else if (year < 1000) {						buffer.append( "0");					}					buffer.append( year )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (month < 9) {						buffer.append('0');					}					buffer.append( ++month )					//#if polish.DateFormatSeparator:defined						//#= .append("${polish.DateFormatSeparator}");					//#else					        .append("-");					//#endif					if (day < 10) {						buffer.append( '0' );					}					buffer.append( day );				//#endif				if  (this.inputMode == DATE_TIME) {					buffer.append(' ');				}			}			if ((this.inputMode == TIME) || (this.inputMode == DATE_TIME)) {				int hour = this.calendar.get( Calendar.HOUR_OF_DAY );				if (hour < 10) {					buffer.append('0');				}				buffer.append( hour )				      .append(':');				int minute = this.calendar.get( Calendar.MINUTE );				if (minute < 10) {					buffer.append('0');				}				buffer.append( minute );			}			this.text = buffer.toString();		} // date != null		if (this.isInitialised) {			this.isInitialised = false;			repaint();		}	}