Gets the week start time with the specified time.

@param time the specified time
@return week start time
350537
public static long getWeekStartTime(final long time) {
        final Calendar start = Calendar.getInstance();
        start.setFirstDayOfWeek(Calendar.MONDAY);
        start.setTimeInMillis(time);
        start.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        start.set(Calendar.HOUR, 0);
        start.set(Calendar.MINUTE, 0);
        start.set(Calendar.SECOND, 0);
        start.set(Calendar.MILLISECOND, 0);

        return start.getTimeInMillis();
    }
69264
public static Time parseTime(String time) {
        Assert.assertTrue("time is required, but value is empty", Checker.isNotEmpty(time));
        String[] times = time.split(ValueConsts.COLON);
        String timeStr = formatTimeString(times[0]) + ":" + (times.length > 1 ? formatTimeString(times[1]) : "00") +
                ":" + (times.length > 2 ? formatTimeString(times[2]) : "00");
        return new Time(DateUtil.parseTime(timeStr).getTime());
    }
182776
private Date getTimeFromInteger(Integer time)
   {
      Date result = null;

      if (time != null)
      {
         int minutes = time.intValue();
         int hours = minutes / 60;
         minutes -= (hours * 60);

         Calendar cal = DateHelper.popCalendar();
         cal.set(Calendar.MILLISECOND, 0);
         cal.set(Calendar.SECOND, 0);
         cal.set(Calendar.MINUTE, minutes);
         cal.set(Calendar.HOUR_OF_DAY, hours);
         result = cal.getTime();
         DateHelper.pushCalendar(cal);
      }

      return (result);
   }
791267
public synchronized Date setStartDate(Date time)
    {
        if ((m_startTime != null) && (m_endTime != null) && (time != null))
        {   // As a default, shift the end date the same distance as the start date
            long lChange = time.getTime() - m_startTime.getTime();
            m_endTime = new Date(m_endTime.getTime() + lChange);
        }
        m_startTime = time;
        return this.getStartDate();
    }
743384
public static Date getStartOfWeek(Date date) {

        if (date == null)
            return null;

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);

        return calendar.getTime();
    }
1306580
public synchronized Instant getStartTime(TimestampProvider times) {
        if (startTime==null) {
            startTime = times.getTime();
        }
        return startTime;
    }
1099880
public String getStartTime() {
    return events.isEmpty()
        ? "unknown"
        : isoDate.format(new Date(events.get(0).timestamp()));
  }
10526
public static int getWeekdayOfDate(String date) {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		int weekday = 0;
		Calendar c = Calendar.getInstance();
		try {
			c.setTime(formatter.parse(date));
			weekday = c.get(Calendar.DAY_OF_WEEK);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return weekday;
	}
200877
public static boolean isTime(String time) {
        if (isEmpty(time)) return defaultEmptyOK;

        String hour;
        String minute;
        String second;

        int timeColon1 = time.indexOf(":");
        int timeColon2 = time.lastIndexOf(":");

        if (timeColon1 <= 0) return false;
        hour = time.substring(0, timeColon1);
        if (timeColon1 == timeColon2) {
            minute = time.substring(timeColon1 + 1);
            second = "0";
        } else {
            minute = time.substring(timeColon1 + 1, timeColon2);
            second = time.substring(timeColon2 + 1);
        }
        return isTime(hour, minute, second);
    }
10525
private String convertTime(final long time) {
    final Date date = new Date(time);
    return FORMAT.format(date);
  }
587747
public static String getShowTimeStr(Integer time) {
        if (time == null) {
            return MINUTE_WINDOW_STR;
        } else if (time.equals(MINUTE_WINDOW)) {
            return MINUTE_WINDOW_STR;
        } else if (time.equals(HOUR_WINDOW)) {
            return HOUR_WINDOW_STR;
        } else if (time.equals(DAY_WINDOW)) {
            return DAY_WINDOW_STR;
        } else if (time.equals(ALL_TIME_WINDOW)) {
            return ALL_WINDOW_STR;
        } else {
            return MINUTE_WINDOW_STR;
        }

    }
605482
public function setInitialTimestamp($time = null)
    {
        $time = (is_null($time)) ? $this->getCurrentTimestamp() : $time;

        $this->initialTimestamp = $time;

        return $this;
    }
62612
public static int getWeekOfDate(String date) {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		int week = 0;
		;
		Calendar c = Calendar.getInstance();
		try {
			c.setTime(formatter.parse(date));
			week = c.get(Calendar.WEEK_OF_YEAR);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return week;
	}
25282
public static String getTimeAgo(long time) {
        // TODO: use DateUtils methods instead
        if (time < 1000000000000L) {
            // if timestamp given in seconds, convert to millis
            time *= 1000;
        }

        long now = System.currentTimeMillis();
        if (time > now || time <= 0) {
            return null;
        }

        final long diff = now - time;
        if (diff < MINUTE) {
            return "just now";
        } else if (diff < 2 * MINUTE) {
            return "a minute ago";
        } else if (diff < 50 * MINUTE) {
            return diff / MINUTE + " minutes ago";
        } else if (diff < 90 * MINUTE) {
            return "an hour ago";
        } else if (diff < 24 * HOUR) {
            return diff / HOUR + " hours ago";
        } else if (diff < 48 * HOUR) {
            return "yesterday";
        } else {
            return diff / DAY + " days ago";
        }
    }
1341768
public static String asTime(long time) {
        if (time > HOUR) {
            return String.format("%.1f h", (time / HOUR));
        } else if (time > MINUTE) {
            return String.format("%.1f m", (time / MINUTE));
        } else if (time > SECOND) {
            return String.format("%.1f s", (time / SECOND));
        } else {
            return String.format("%d ms", time);
        }
    }
472989
public static String getTimestamp(Date time) {
        return getTimestampFormatter().format(time == null ? new Date() : time);
    }
1028370
public static Date getFirstDayFromCurrentWeek(Date d) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);        
        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }