if (result.attribute(m_timeStampName).isDate()) {
int origIndex = result.attribute(m_timeStampName).index();
// find first non-missing date and set as base
GregorianCalendar c = new GregorianCalendar();
for (int i = 0; i < result.numInstances(); i++) {
if (!result.instance(i).isMissing(origIndex)) {
if (m_dateBasedPeriodicity.getPeriodicity() == Periodicity.MONTHLY
|| m_dateBasedPeriodicity.getPeriodicity() == Periodicity.WEEKLY
|| m_dateBasedPeriodicity.getPeriodicity() == Periodicity.QUARTERLY) {
Date d = new Date((long) result.instance(i).value(origIndex));