List of utility methods to do Time to String
String | time2String(Date time) time String return timeFormat.format(time);
|
String | time2string(double t) Converts double value of a time stamp to a string suitable for display. NumberFormat form = NumberFormat.getInstance(); form.setMinimumIntegerDigits(2); form.setMinimumFractionDigits(0); form.setMaximumIntegerDigits(2); form.setMaximumFractionDigits(2); double stime = t; int hours = (int) Math.floor(stime); stime = (stime - hours) * 60; ... |
String | time2String(long time) time String SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd HH:mm"); Calendar toyear = Calendar.getInstance(); Calendar today = Calendar.getInstance(); toyear.set(Calendar.MONTH, Calendar.JANUARY); toyear.set(Calendar.DATE, 1); toyear.set(Calendar.HOUR_OF_DAY, 0); toyear.set(Calendar.MINUTE, 0); toyear.set(Calendar.SECOND, 0); ... |
boolean | timesAreEqual(Date date1, Date date2) times Are Equal if (date1 == null) { return date2 == null; if (date2 == null) { return date1 == null; return timeOnlyFormat.format(date1).equals(timeOnlyFormat.format(date2)); |
String | timeStr(Date _Date) time Str if (_Date == null) return ""; SimpleDateFormat _SimpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.SIMPLIFIED_CHINESE); return _SimpleDateFormat.format(_Date); |
String | timeString() time String return timestampToString(System.currentTimeMillis());
|
String | timeString(double time) time String if (Double.isNaN(time)) { return "NA"; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); long longTime = Math.round(time); Date date = new Date(longTime); return formatter.format(date); ... |
String | timeString(long tickNo, long offset) time String return timeFormat.format(time(tickNo, offset));
|
Date | timeString2Date(String time) time String Date if (time == null) { return null; return new SimpleDateFormat(timeFormat).parse(time); |
String | timeToDeparture(String startTime) Calculates minutes from now to a specific time in the future int diffMinutes = -1; Calendar now = Calendar.getInstance(); now.setTime(new Date()); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date date = null; try { date = dateFormat.parse(startTime); } catch (ParseException e) { ... |