List of utility methods to do Date Now
BigDecimal | getCurrentTimeAsNumber() get Current Time As Number String returnStr = null; SimpleDateFormat f = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = new Date(); returnStr = f.format(date); return new BigDecimal(returnStr); |
String | getCurrentTimeAsString() Get current Time. Calendar calendar = Calendar.getInstance(); int hour = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); int millisecond = calendar.get(Calendar.MILLISECOND); String mDateFormat = ""; DecimalFormat twoDigitFormat = new DecimalFormat("00"); mDateFormat = twoDigitFormat.format(hour) + twoDigitFormat.format(minute) + twoDigitFormat.format(second) ... |
String | getCurrentTimeForFileName() get Current Time For File Name SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmssS"); Date timeStr = Calendar.getInstance().getTime(); return formatter.format(timeStr); |
String | getCurrentTimeForLog() Get current time string in format mm-dd-yy 5:31:31 PM return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.US).format(new Date()) .replaceAll("/", "-"); |
String | getCurrentTimeForName() Gets current date (for random name of new item) SimpleDateFormat f = new SimpleDateFormat("yyMMddHHmmss_"); return f.format(Calendar.getInstance().getTime()); |
String | getCurrentTimeForUseInAFileName() get Current Time For Use In A File Name String time = DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime()); time = time.replaceAll(":", "_"); time = time.replaceAll(",", ""); return time; |
String | getCurrentTimeInMySqlTime() get Current Time In My Sql Time SimpleDateFormat sdf = new SimpleDateFormat(_16DIGIT_DATE_TIME_MYSQL); return sdf.format(new Date()); |
String | getCurrentTimeInMySqlTime() get Current Time In My Sql Time SimpleDateFormat sdf = new SimpleDateFormat(_16DIGIT_DATE_TIME_MYSQL); return sdf.format(getTimezoneDate(_DEFAULT_TIMEZON)); |
String | getCurrentTimeInString(SimpleDateFormat dateFormat) get current time in milliseconds return getTime(getCurrentTimeInLong(), dateFormat);
|
String | getCurrentTimeInString(String format) get Current Time In String Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); |