try { return new SimpleDateFormat(FORMAT).parse(dateTime); } catch (ParseException e) { throw new IllegalArgumentException(e);
final Calendar calTime = Calendar.getInstance(); final SimpleDateFormat sdf = new SimpleDateFormat(DATE_FMT_FULL, Locale.ENGLISH); final Date date = (Date) sdf.parse(dateTime); calTime.setTime(date); return calTime;
Calendar c = null; String dateFormatString = "yyyy-MM-dd'T'hh:mm:ss"; try { SimpleDateFormat sdf = new SimpleDateFormat(dateFormatString); Date d = sdf.parse(cpeDateTime); c = Calendar.getInstance(); c.setTime(d); } catch (Exception e) { ...
getCalendarFromDate.
final Calendar cal = GregorianCalendar.getInstance(); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { final Date date = sdf.parse(dateTime); cal.setTime(date); } catch (final ParseException e) { return null; return cal;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format2 = new SimpleDateFormat("HH:mm:ss"); StringBuffer sb = new StringBuffer(); try { playDate = format1.format(format.parse(playDate)); } catch (ParseException e) { e.printStackTrace(); ...
Calendar calendar = Calendar.getInstance(); if (flag.equals("DAY")) { calendar.add(Calendar.DAY_OF_MONTH, -value); } else if (flag.equals("HOUR")) { calendar.add(Calendar.HOUR_OF_DAY, -value); } else if (flag.equals("MINUTE")) { calendar.add(Calendar.MINUTE, -value); Date dateTime = calendar.getTime(); return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dateTime);
return executionFormat.parse(input);
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); Date date = formatter.parse(timeStr, new ParsePosition(0)); return date;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); long dif = df.parse(dateTime).getTime() - 86400 * 1000; Date date = new Date(); date.setTime(dif); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date);
return name + "-" + getCurrDate() + "-" + getCurrTime() + "-" + getRandomNumber();