class Transaction { import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; int dayOfWeek; String ckodate; String ckotime; String deweyClass; String title; public String getTimeStr() { return ckotime.substring(0,5) ; } public int getHour() { return ( Integer.valueOf( ckotime.substring(0,2) )) ; } public int getMinute() { return ( Integer.valueOf( ckotime.substring(3,5))) ; } //This returns the time of day as a fraction of 1 public double getTime() { double hourfraction = (double) getHour() / 24 ; double minutefraction = (double) getMinute() / (24 * 60) ; return hourfraction + minutefraction; } //This returns the day as a fraction of the month public float getDay() { float theday = Integer.valueOf( ckodate.substring(8,10) ) ; return theday / 30 ; } public int getBigDewey() { try{ return ( Integer.valueOf(deweyClass.substring(0,3) ) ) ; } catch (NumberFormatException n) { return 9999; } } //Uses some code from zach to return the # of the day. public int getDayNumber() { try { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("y-M-d"); Date date = sdf.parse(ckodate); cal.setTime(date); dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); return dayOfWeek; } catch (Exception e){ //do anything you want to handle the exception println("Unable to parse date stamp"); return 999; } } }