List of usage examples for java.util Date getDate
@Deprecated public int getDate()
From source file:com.sccl.attech.common.utils.DateUtils.java
/** * ?/* ww w.j a v a2 s.c om*/ * @param date * @return */ public static int getLastTimeNum(Date date) { Calendar cal = Calendar.getInstance(); int year = date.getYear() + 1900; int month = date.getMonth() + 1; cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.DAY_OF_MONTH, -1); Date lastDate = cal.getTime(); int sum = lastDate.getDate(); return sum; }
From source file:commonUtils.FunctionUtils.java
public static String DateToDirView() { Date inDate = DateTimeUtils.getNow(); String sYear = ConvertUtils.toString(inDate.getYear() + 1900); int iNumber = inDate.getMonth() + 1; String sMonth = iNumber >= 10 ? ConvertUtils.toString(iNumber) : "0" + ConvertUtils.toString(iNumber); iNumber = inDate.getDate(); String sDay = iNumber >= 10 ? ConvertUtils.toString(iNumber) : "0" + ConvertUtils.toString(iNumber); return ConvertUtils.toString(sYear + sMonth + sDay); }
From source file:DateUtil.java
/** * Checks the day, month and year are equal. *///from w w w. j a v a 2s.c o m public static boolean dateEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) return false; return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2.getYear(); }
From source file:DateUtil.java
/** * Checks the second, hour, month, day, month and year are equal. *///from ww w . ja v a2s .co m public static boolean dateTimeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) return false; return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2.getYear() && d1.getHours() == d2.getHours() && d1.getMinutes() == d2.getMinutes() && d1.getSeconds() == d2.getSeconds(); }
From source file:com.qingzhi.apps.fax.util.UIUtils.java
public static String getDataFormat(String time) { String formatTime = ""; try {/*from w w w . j a v a2s . co m*/ Date date = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss.SSS").parse(time); Date nowDate = new Date(); if (date.getYear() == nowDate.getYear() && date.getMonth() == nowDate.getMonth() && date.getDate() == nowDate.getDate()) { formatTime = "" + new SimpleDateFormat("HH:mm:ss").format(date); } else if (date.getYear() == nowDate.getYear() && date.getMonth() == nowDate.getMonth() && date.getDate() == (nowDate.getDate() - 1)) { formatTime = "" + new SimpleDateFormat("HH:mm:ss").format(date); } else if (date.getYear() == nowDate.getYear()) { formatTime = new SimpleDateFormat("MM-dd HH:mm").format(date); } else { formatTime = new SimpleDateFormat("yyyy-MM-dd").format(date); } } catch (Exception e) { formatTime = time; } return formatTime; }
From source file:com.bjorsond.android.timeline.utilities.Utilities.java
public static int convertZoomTypeAndDateToZoomValue(Zoom zoom, Date date) { switch (zoom.getType()) { case HOUR_MODE: return date.getHours(); case DAY_MODE: return date.getDate(); case WEEK_MODE: return getWeekNumberOfDate(date); case MONTH_MODE: return getMonthNumberOfDate(date); default:/*from w ww. j av a 2 s .c om*/ return -1; } }
From source file:com.cssweb.quote.util.Utils.java
public static String format(Date date) { String str = ""; str = date.getYear() + "-" + formatTwo(date.getMonth() + 1) + "-" + formatTwo(date.getDate()) + " " + formatTwo(date.getHours()) + ":" + formatTwo(date.getMinutes()) + ":00"; return str;/*w w w . jav a2s .com*/ }
From source file:it.scoppelletti.mobilepower.types.SimpleDate.java
/** * Restituisce la data rappresentata da una stringa in formato ISO 8601 * ({@code yyyy-MM-dd})./*from w w w .ja v a2 s.c o m*/ * * @param s Stringa. * @return Data. Se la stringa {@code s} è nulla, restituisce la * data nulla. * @see #NIL * @see #isEmpty */ public static SimpleDate fromISOString(String s) throws ParseException { Date value; SimpleDate date; SimpleDateFormat fmt; if (StringUtils.isBlank(s)) { return SimpleDate.NIL; } fmt = new SimpleDateFormat("yyyy-MM-dd"); value = fmt.parse(s); date = new SimpleDate(1900 + value.getYear(), value.getMonth(), value.getDate()); return date; }
From source file:org.infoscoop.request.filter.rss.RssHandler.java
/** * Return the date whose form is "yyyy/MM/dd HH:mm:ss" -> obsolute * javascript Date :An argument form of the object instance. * Return the date whose form is "yyyy,MM,dd,HH,mm,ss". * // ww w . j a va 2s . c o m * @param date * @return */ public static String getFullDate(Date date) { if (date == null) { return null; } try { // return formatFullDate.format(date); return (date.getYear() + 1900) + "," + date.getMonth() + "," + date.getDate() + "," + date.getHours() + "," + date.getMinutes() + "," + date.getSeconds(); } catch (IllegalArgumentException e1) { return null; } }
From source file:eionet.meta.exports.ods.Ods.java
/** * Returns date./*w w w .ja v a2 s . c om*/ * * @param timestamp * time stamp * * @return date as a string */ public static String getDate(long timestamp) { Date date = new Date(timestamp); String year = String.valueOf(1900 + date.getYear()); String month = String.valueOf(date.getMonth() + 1); month = (month.length() < 2) ? ("0" + month) : month; String day = String.valueOf(date.getDate()); day = (day.length() < 2) ? ("0" + day) : day; String hours = String.valueOf(date.getHours()); hours = (hours.length() < 2) ? ("0" + hours) : hours; String minutes = String.valueOf(date.getMinutes()); minutes = (minutes.length() < 2) ? ("0" + minutes) : minutes; String seconds = String.valueOf(date.getSeconds()); seconds = (seconds.length() < 2) ? ("0" + seconds) : seconds; String time = year; time = time + "-" + month; time = time + "-" + day; time = time + "T" + hours; time = time + ":" + minutes; time = time + ":" + seconds; return time; }