From: Eric P. <th...@us...> - 2009-11-25 05:02:19
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8144 Modified Files: DateUtil.java Log Message: Added wrappers and options for getShortFileDate. Index: DateUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/DateUtil.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** DateUtil.java 19 Sep 2009 03:49:23 -0000 1.19 --- DateUtil.java 25 Nov 2009 05:02:02 -0000 1.20 *************** *** 182,197 **** ! /** ! * Convenience wrapper which gets a new Calendar instance for the given ! * date before calling through to the calendar version of the same ! * method. ! */ public static String getShortFileDate(Date date) { Calendar cal=Calendar.getInstance(); cal.setTime(date); ! return getShortFileDate(cal); } - - /** * Return a short date identifier useful for naming a file. This is --- 182,201 ---- ! /** Convenience wrapper */ public static String getShortFileDate(Date date) { + return getShortFileDate(date,"_"); + } + /** Convenience wrapper */ + public static String getShortFileDate(Date date,String sep) + { Calendar cal=Calendar.getInstance(); cal.setTime(date); ! return getShortFileDate(cal,sep); ! } ! /** Convenience wrapper */ ! public static String getShortfileDate(Calendar cal) ! { ! return getShortFileDate(cal,"_"); } /** * Return a short date identifier useful for naming a file. This is *************** *** 199,207 **** * files will be ordered correctly via directory access. */ ! public static String getShortFileDate(Calendar cal) { StringBuffer buf=new StringBuffer(); int year=cal.get(Calendar.YEAR); buf.append(year); ! buf.append("_"); int month=cal.get(Calendar.MONTH); month++; //jan is zero --- 203,211 ---- * files will be ordered correctly via directory access. */ ! public static String getShortFileDate(Calendar cal,String sep) { StringBuffer buf=new StringBuffer(); int year=cal.get(Calendar.YEAR); buf.append(year); ! buf.append(sep); int month=cal.get(Calendar.MONTH); month++; //jan is zero *************** *** 209,213 **** buf.append("0"); } buf.append(month); ! buf.append("_"); int day=cal.get(Calendar.DAY_OF_MONTH); if(day<10) { --- 213,217 ---- buf.append("0"); } buf.append(month); ! buf.append(sep); int day=cal.get(Calendar.DAY_OF_MONTH); if(day<10) { |