public Date getJavaValue() { return filetimeToDate( fileTime ); }
/** * Sets the total time spent in editing the document. * * @param time The time to set. */ public void setEditTime(final long time) { final Date d = Filetime.filetimeToDate(time); getFirstSection().setProperty(PropertyIDMap.PID_EDITTIME, Variant.VT_FILETIME, d); }
public Date getJavaValue() { return filetimeToDate( fileTime ); }
/** * Constructs a single new date attribute from the id, type, * and the contents of the stream */ protected MAPIDateAttribute(MAPIProperty property, int type, byte[] data) { super(property, type, data); // The value is a 64 bit Windows Filetime this.data = Filetime.filetimeToDate( LittleEndian.getLong(data, 0) ); }
/** * Sets the total time spent in editing the document. * * @param time The time to set. */ public void setEditTime(final long time) { final Date d = Filetime.filetimeToDate(time); getFirstSection().setProperty(PropertyIDMap.PID_EDITTIME, Variant.VT_FILETIME, d); }
/** * Constructs a single new date attribute from the id, type, * and the contents of the stream */ protected TNEFDateAttribute(int id, int type, InputStream inp) throws IOException { super(id, type, inp); byte[] binData = getData(); if(binData.length == 8) { // The value is a 64 bit Windows Filetime this.data = Filetime.filetimeToDate( LittleEndian.getLong(getData(), 0) ); } else if(binData.length == 14) { // It's the 7 date fields. We think it's in UTC... Calendar c = LocaleUtil.getLocaleCalendar(LocaleUtil.TIMEZONE_UTC); c.set(Calendar.YEAR, LittleEndian.getUShort(binData, 0)); c.set(Calendar.MONTH, LittleEndian.getUShort(binData, 2) - 1); // Java months are 0 based! c.set(Calendar.DAY_OF_MONTH, LittleEndian.getUShort(binData, 4)); c.set(Calendar.HOUR_OF_DAY, LittleEndian.getUShort(binData, 6)); c.set(Calendar.MINUTE, LittleEndian.getUShort(binData, 8)); c.set(Calendar.SECOND, LittleEndian.getUShort(binData, 10)); // The 7th field is day of week, which we don't require c.clear(Calendar.MILLISECOND); // Not set in the file this.data = c.getTime(); } else { throw new IllegalArgumentException("Invalid date, found " + binData.length + " bytes"); } }