List of utility methods to do Date Format As
String | getDateAsRFC822String(Date date) RFC822 has strict rules how to format a date. return RFC822DATEFORMAT.format(date);
|
String | getDateYYYYMMDD() get Date YYYYMMDD SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); String NDate = formatter.format(new Date()); return NDate; |
Date | getDateYYYYMMDD(Object yyyymmdd) Helper parsing two kinds of dates: 1. if (yyyymmdd == null) return null; String sdate = yyyymmdd.toString(); if (sdate.lastIndexOf('-') > sdate.indexOf('-')) { SimpleDateFormat formatter = s_formatsYMD[0]; synchronized (formatter) { return formatter.parse(sdate); Calendar calendar = Calendar.getInstance(); SimpleDateFormat formatter = s_formatsYMD[1]; synchronized (formatter) { calendar.setTime(formatter.parse(sdate)); int lastDay = calendar.getActualMaximum(Calendar.DATE); calendar.set(Calendar.DATE, lastDay); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); |
String[] | getDateYYYYMMDD_HHSSMMNNN() get Date YYYYMMDHHSSMMNNN SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmmssms"); return sdf.format(new Date()).split("\\s+"); |
String | getDateYyyyMmWithoutDash() get Date Yyyy Mm Without Dash SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM"); return simpleDateFormat.format(new Date()); |