List of usage examples for java.text ParseException printStackTrace
public void printStackTrace()
From source file:com.joinsystem.goku.common.utils.DateUtil.java
/** * ?()//w w w . j a v a 2 s . c o m * ???? * @param date * @return */ public static int secondBetween(String date) { SimpleDateFormat sdfSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { long presentDate = sdfSecond.parse(sdfSecond.format(new Date())).getTime(); long enterDate = sdfSecond.parse(date).getTime(); return (int) ((presentDate - enterDate) / 1000); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
From source file:com.joinsystem.goku.common.utils.DateUtil.java
/** * ()//from www . j a v a2 s .co m * ???? * @param beginDate * @param endDate ? * @return */ public static int secondBetween(String beginDate, String endDate) { SimpleDateFormat sdfSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { long _enginDate = sdfSecond.parse(beginDate).getTime(); long _endDate = sdfSecond.parse(endDate).getTime(); return (int) ((_enginDate - _endDate) / 1000); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
From source file:net.diogobohm.timed.impl.codec.TaskCodecImpl.java
@Override public Task decode(DBTask task, Activity activity, Project project, Set<Tag> tags) { Date start = null;// w w w.j ava 2s . c o m Optional<Date> end = Optional.absent(); String description = task.getDescription(); try { start = DATETIME_FORMATTER.parse(task.getStartDateTime()); if (task.getFinishDateTime() != null) { end = Optional.of(DATETIME_FORMATTER.parse(task.getFinishDateTime())); } } catch (ParseException ex) { ex.printStackTrace(); } return new Task(activity, project, start, end, description, tags); }
From source file:com.joinsystem.goku.common.utils.DateUtil.java
/** * ?()//from w ww . j a va2s. co m * ???? * @param date * @return */ public static int secondBetween(Date date) { if (date == null) { return 0; } SimpleDateFormat sdfSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { long presentDate = sdfSecond.parse(sdfSecond.format(new Date())).getTime(); long enterDate = date.getTime(); return (int) ((presentDate - enterDate) / 1000); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
From source file:com.glaf.core.util.converter.DateConverter.java
public Object convert(Class type, Object value) { if (value == null) { return null; }/*from w ww . j av a2s . c o m*/ if (value instanceof String) { String tmp = (String) value; if (tmp.trim().length() == 0) { return null; } else { try { return DateUtils.parseDate(tmp, parsePatterns); } catch (ParseException ex) { ex.printStackTrace(); return com.glaf.core.util.DateUtils.toDate(tmp); } } } else if (value instanceof Long) { Long ts = (Long) value; Date date = new Date(ts); return date; } return value; }
From source file:com.joinsystem.goku.common.utils.DateUtil.java
/** * // ww w . j a va 2 s .co m * @param beginDate * @param endDate ? * @return */ public static int daysBetween(String beginDate, String endDate) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); try { cal.setTime(sdf.parse(beginDate)); cal2.setTime(sdf.parse(endDate)); long time1 = cal.getTimeInMillis(); long time2 = cal2.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 3600 * 24); return (int) between_days; } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
From source file:com.capgemini.parking.places.ParkingGroupFactory.java
private Long getTimeStampFrom(String timestamp) { Long time = 1L;// w w w . j av a 2 s . c o m try { SimpleDateFormat date = new SimpleDateFormat(configuration.getDate()); date.setTimeZone(TimeZone.getTimeZone(configuration.getTimezone())); return date.parse(timestamp).getTime(); } catch (ParseException ex) { ex.printStackTrace(); } return time; }
From source file:com.fb.audiencenetwork.scrollapp.NasaPost.java
private String convertDateToHumanDate() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat humanDateFormat = new SimpleDateFormat("dd MMMM yyyy"); try {//from ww w . j av a2 s .c o m Date date = dateFormat.parse(mDate); Calendar cal = Calendar.getInstance(); cal.setTime(date); return humanDateFormat.format(cal.getTime()); } catch (ParseException e) { e.printStackTrace(); return null; } }
From source file:net.diogobohm.timed.impl.ui.overviewwindow.OverviewWindowModel.java
public Date getStartDate() { try {// www . j a va 2s .c o m return DAY_FORMATTER.parse(getStartDateHolder().getValue()); } catch (ParseException ex) { ex.printStackTrace(); } return new Date(); }
From source file:net.diogobohm.timed.impl.ui.overviewwindow.OverviewWindowModel.java
public Date getEndDate() { try {/* w ww. j a va2 s . co m*/ return DAY_FORMATTER.parse(getEndDateHolder().getValue()); } catch (ParseException ex) { ex.printStackTrace(); } return new Date(); }