private String _text = null;
private String _timeText = null;
- private static DateFormat DEFAULT_DATE_FORMAT = DateFormat.getDateTimeInstance();
- private static DateFormat DEFAULT_TIME_FORMAT = DateFormat.getTimeInstance();
- private static DateFormat ISO_8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ private static final DateFormat DEFAULT_DATE_FORMAT = DateFormat.getDateTimeInstance();
+ private static final DateFormat DEFAULT_TIME_FORMAT = DateFormat.getTimeInstance();
+ private static final DateFormat ISO_8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ private static final DateFormat ISO_8601_FORMAT_NOZ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
private static DateFormat[] ALL_DATE_FORMATS = null;
private static Calendar CALENDAR = null;
private static long SECS_SINCE_1970 = 0L;
new SimpleDateFormat("HH:mm:ss dd MMM yyyy"),
new SimpleDateFormat("dd MMM yyyy HH:mm:ss"),
new SimpleDateFormat("yyyy MMM dd HH:mm:ss"),
- ISO_8601_FORMAT
+ ISO_8601_FORMAT, ISO_8601_FORMAT_NOZ
};
}
return _valid;
}
+ /**
+ * @param inOther other Timestamp
+ * @return true if this one is after the other
+ */
+ public boolean isAfter(Timestamp inOther)
+ {
+ return _seconds > inOther._seconds;
+ }
/**
* Calculate the difference between two Timestamps in seconds
return _seconds - inOther._seconds;
}
+ /**
+ * Add the given number of seconds offset
+ * @param inOffset number of seconds to add/subtract
+ */
+ public void addOffset(long inOffset)
+ {
+ _seconds += inOffset;
+ _text = null;
+ }
/**
* Add the given TimeDifference to this Timestamp
* @param inOffset TimeDifference to add
* @return new Timestamp object
*/
- public Timestamp addOffset(TimeDifference inOffset)
+ public Timestamp createPlusOffset(TimeDifference inOffset)
{
return new Timestamp((_seconds + inOffset.getTotalSeconds()) * 1000L);
}
* @param inOffset TimeDifference to subtract
* @return new Timestamp object
*/
- public Timestamp subtractOffset(TimeDifference inOffset)
+ public Timestamp createMinusOffset(TimeDifference inOffset)
{
return new Timestamp((_seconds - inOffset.getTotalSeconds()) * 1000L);
}