List of utility methods to do Date Format
String | getCurrentFormatedDate() get Current Formated Date return formatDate(new Date()); |
String | getCurrentMonth() get Current Month return getFormatCurrentTime("MM"); |
String | getCurrentTime() get Current Time return getFormatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss"); |
String | getCurrentYear() get Current Year return getFormatCurrentTime("yyyy"); |
String | getDateEN() get Date in format of "yyyy-MM-dd HH:mm:ss" SimpleDateFormat format1 = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); String date1 = format1.format(new Date(System.currentTimeMillis())); return date1; |
SimpleDateFormat | getDefaultFormatter(Date date) Returns SimpleDateFormat instance that formats date in default application format (time only for recent dates, day and month for messages earlier than year and month/day/year for older) try { Date now = new Date(); if (now.before(date)) { return new SimpleDateFormat("MM/dd/yyyy h:mm:ss a", Locale.US); long ms = now.getTime() - date.getTime(); long seconds = ms / 1000; ... |
String | getFormatCurrentAdd(int amount, String format) get Format Current Add Date d = getDateAdd(new Date(), amount); return getFormatDateTime(d, format); |
String | getFormatCurrentTime(String format) get Format Current Time return getFormatDateTime(new Date(), format); |
String | getFormatCurrentTime(String format) get Format Current Time return getFormatDateTime(new Date(), format); |
String | getFormatDate(Date date) get Format Date return getFormatDateTime(date, "yyyy-MM-dd"); |