/** * Get this field as a java date (the raw date type). * @return This datetime. */ public java.util.Date getDateTime() { return (java.util.Date)this.getData(); // Get the physical data } /**
/** * Get this field as a java date (the raw date type). * @return This datetime. */ public java.util.Date getDateTime() { return (java.util.Date)this.getData(); // Get the physical data } /**
/** * Get this field as a java date (the raw date type). * @return This datetime. */ public java.util.Date getDateTime() { return (java.util.Date)this.getData(); // Get the physical data } /**
/** * Get the Value of this field as a double. * Converts the time from getTime() to a double (may lose some precision). * @return The value of this field. */ public double getValue() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return 0; return (double)dateValue.getTime(); } /**
/** * Get the Value of this field as a double. * Converts the time from getTime() to a double (may lose some precision). * @return The value of this field. */ public double getValue() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return 0; return (double)dateValue.getTime(); } /**
/** * Get the Value of this field as a double. * Converts the time from getTime() to a double (may lose some precision). * @return The value of this field. */ public double getValue() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return 0; return (double)dateValue.getTime(); } /**
/** * Get this field as a java calendar value. * @return This field as a calendar value. */ public Calendar getCalendar() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(dateValue); return calendar; } /**
/** * Get this field as a java calendar value. * @return This field as a calendar value. */ public Calendar getCalendar() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(dateValue); return calendar; } /**
/** * Get this field as a java calendar value. * @return This field as a calendar value. */ public Calendar getCalendar() { // Get this field's value java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue == null) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(dateValue); return calendar; } /**
/** * Get this field in SQL format. * For dates, I use the DateConverter.binaryToString SQL formats (ie., XX/XX/XX). * @return The date formatted as a SQL string. */ public String getSQLString() { return DateConverter.binaryToString(this.getData(), DBConstants.SQL_DATE_TIME_FORMAT); } /**
/** * Get this field in SQL format. * For dates, I use the DateConverter.binaryToString SQL formats (ie., XX/XX/XX). * @return The date formatted as a SQL string. */ public String getSQLString() { return DateConverter.binaryToString(this.getData(), DBConstants.SQL_DATE_TIME_FORMAT); } /**
/** * Get this field in SQL format. * For dates, I use the DateConverter.binaryToString SQL formats (ie., XX/XX/XX). * @return The date formatted as a SQL string. */ public String getSQLString() { return DateConverter.binaryToString(this.getData(), DBConstants.SQL_DATE_TIME_FORMAT); } /**
/** * Write the physical data in this field to a stream file. * @param daOut Output stream to add this field to. * @param bFixedLength If false (default) be sure to get the length from the stream. * @return boolean Success? */ public boolean write(DataOutputStream daOut, boolean bFixedLength) { try { java.util.Date daData = (java.util.Date)this.getData(); long lData; if (daData == null) lData = Long.MIN_VALUE + 1; else lData = daData.getTime(); daOut.writeLong(lData); return true; } catch (IOException ex) { ex.printStackTrace(); return false; } } /**
/** * Write the physical data in this field to a stream file. * @param daOut Output stream to add this field to. * @param bFixedLength If false (default) be sure to get the length from the stream. * @return boolean Success? */ public boolean write(DataOutputStream daOut, boolean bFixedLength) { try { java.util.Date daData = (java.util.Date)this.getData(); long lData; if (daData == null) lData = Long.MIN_VALUE + 1; else lData = daData.getTime(); daOut.writeLong(lData); return true; } catch (IOException ex) { ex.printStackTrace(); return false; } } /**
/** * Write the physical data in this field to a stream file. * @param daOut Output stream to add this field to. * @param bFixedLength If false (default) be sure to get the length from the stream. * @return boolean Success? */ public boolean write(DataOutputStream daOut, boolean bFixedLength) { try { java.util.Date daData = (java.util.Date)this.getData(); long lData; if (daData == null) lData = Long.MIN_VALUE + 1; else lData = daData.getTime(); daOut.writeLong(lData); return true; } catch (IOException ex) { ex.printStackTrace(); return false; } } /**
/** * Compare field to this and return < > or = (-,+,0). * @return compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0); java.util.Date dateSmall = m_calendar.getTime(); java.util.Date time1 = dateSmall; java.util.Date time2 = dateSmall; java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue != null) time1 = dateValue; dateValue = (java.util.Date)field.getData(); // Get the physical data if (dateValue != null) time2 = dateValue; return time1.compareTo(time2); } /**
/** * Compare field to this and return < > or = (-,+,0). * @return compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0); java.util.Date dateSmall = m_calendar.getTime(); java.util.Date time1 = dateSmall; java.util.Date time2 = dateSmall; java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue != null) time1 = dateValue; dateValue = (java.util.Date)field.getData(); // Get the physical data if (dateValue != null) time2 = dateValue; return time1.compareTo(time2); } /**
/** * Compare field to this and return < > or = (-,+,0). * @return compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0); java.util.Date dateSmall = m_calendar.getTime(); java.util.Date time1 = dateSmall; java.util.Date time2 = dateSmall; java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue != null) time1 = dateValue; dateValue = (java.util.Date)field.getData(); // Get the physical data if (dateValue != null) time2 = dateValue; return time1.compareTo(time2); } /**
java.util.Date time = (java.util.Date)this.getData(); Converter.initGlobals(); Converter.gCalendar.setTime(time);
java.util.Date time = (java.util.Date)this.getData(); Converter.initGlobals(); Converter.gCalendar.setTime(time);