List of usage examples for java.util Date getSeconds
@Deprecated public int getSeconds()
From source file:Main.java
public static final int getSecondByMill(long mill) { Date curDate = new Date(mill); return curDate.getSeconds(); }
From source file:Main.java
public static Date getTaskDueDateFromIso8601String(String s) { System.err.println("Importing date string: " + s); Date date = getDateFromIso8601String(s); System.err.println("Got date: " + date); if (date != null) { if (date.getHours() == 23 && date.getMinutes() == 59 && date.getSeconds() == 59) { date.setHours(12);// w w w. j a va 2 s . c o m date.setMinutes(0); date.setSeconds(0); } } return date; }
From source file:com.b5m.user.frame.util.DateUtils.java
/** * ? //from w w w. j a v a 2s.com * @return int */ public static int remainSecondsInToday() { int remainSeconds = DAY_SECONDS; Date date = new Date(); int currentTimeSendcods = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(); remainSeconds = DAY_SECONDS - currentTimeSendcods; return remainSeconds; }
From source file:Main.java
public static int milli2int(long milli) { Date date = new Date(milli); int total = 0; int year = date.getYear() - 112; int month = date.getMonth() + 1; int day = date.getDate(); int hour = date.getHours(); int minute = date.getMinutes(); int sec = date.getSeconds(); total = year << 26;/*from www.j ava 2s . com*/ total |= month << 22; total |= day << 17; total |= hour << 12; total |= minute << 6; total |= sec; return total; }
From source file:ch.ethz.inf.vs.android.g54.a4.util.SnapshotCache.java
private static String constructFileName(String name) { Date d = new Date(); return String.format("%d-%d-%d_%d-%d-%d_%s.%s", d.getYear() + 1900, d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds(), name, FILE_EXTENSION); }
From source file:Main.java
/** * Gets the default ARO trace folder name in the HH:MM:SS:DD:MM:YY format. * /*w ww . java2 s . c o m*/ * @return The default ARO trace folder name. */ public static String getDefaultTraceFolderName() { final Date systemDate = new Date(); final Calendar now = Calendar.getInstance(); final int currenthours = systemDate.getHours(); final int currentminutes = systemDate.getMinutes(); final int currentseconds = systemDate.getSeconds(); final int currentdate = now.get(Calendar.DATE); // java calendar int currentmonth = now.get(Calendar.MONTH); // As Jan is defined as 0 in currentmonth = currentmonth + 1; if (currentmonth >= 13) // As Jan is defined as 0 in java calendar currentmonth = 1; String currentMonth = Integer.toString(currentmonth); String currentDate = Integer.toString(currentdate); String currentHours = Integer.toString(currenthours); String currentMinutes = Integer.toString(currentminutes); String currentSeconds = Integer.toString(currentseconds - 1); if (currentmonth < 10) { currentMonth = ""; currentMonth = "0" + currentmonth; } if (currentdate < 10) { currentDate = ""; currentDate = "0" + currentdate; } if (currenthours < 10) { currentHours = ""; currentHours = "0" + currenthours; } if (currentminutes < 10) { currentMinutes = ""; currentMinutes = "0" + currentminutes; } if (currentseconds < 10) { currentSeconds = ""; currentSeconds = "0" + currentseconds; } final String folderName = now.get(Calendar.YEAR) + "-" + currentMonth + "-" + currentDate + "-" + currentHours + "-" + currentMinutes + "-" + currentSeconds; return folderName; }
From source file:com.fluidops.iwb.api.valueresolver.ValueResolverUtil.java
/** * Converts a system date like '2011-03-31T19:54:33' to user-readable date. * If the input is not a valid system date, the value is returned as is. * /*from w ww.j ava 2 s.c o m*/ * @param sysdate * @return */ @SuppressWarnings("deprecation") public static String resolveSystemDate(String sysdate) { Date d = ReadDataManagerImpl.ISOliteralToDate(sysdate); if (d == null) return StringEscapeUtils.escapeHtml(sysdate); DateFormat df = null; if (d.getHours() == 0 && d.getMinutes() == 0 && d.getSeconds() == 0) df = new SimpleDateFormat("MMMMM dd, yyyy"); else df = new SimpleDateFormat("MMMMM dd, yyyy, HH:mm:ss"); return df.format(d); }
From source file:DateUtil.java
/** * Tells you if the date part of a datetime is in a certain time range. *//* ww w .j a v a 2 s .com*/ public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) && (!(d.after(start) && d.before(end)))) { return false; } if (end.before(start) && (!(d.after(end) || d.before(start)))) { return false; } return true; }
From source file:DateUtil.java
/** * Checks the hour, minute and second are equal. *///from ww w . j a va2 s .com public static boolean timeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) return false; return d1.getHours() == d2.getHours() && d1.getMinutes() == d2.getMinutes() && d1.getSeconds() == d2.getSeconds(); }
From source file:com.cloudmine.api.CMObject.java
/** * This method should be used to check date equality when overriding {@link #equals(Object)}, as * serialized dates are stored in seconds. * @param firstDate a null possible date * @param secondDate a null possible date * @return true if the two dates represent the same second in time *///from www.j a v a2s . co m public static boolean dateEquals(Date firstDate, Date secondDate) { if ((firstDate == null && secondDate != null) || (firstDate != null && secondDate == null)) { return false; } if (firstDate == null && secondDate == null) { return true; } int firstSeconds = firstDate.getSeconds(); int secondSeconds = secondDate.getSeconds(); return firstSeconds == secondSeconds; }