Helper for getting epoch {@link DateTime} object

@return {@link DateTime} representing epoch
433670
public static DateTime epoch() {
		 MutableDateTime epoch = new MutableDateTime();
		 
	     epoch.setDate(0); 
	     epoch.setTime(0);
	        
	     return epoch.toDateTime();
	}
1327968
public DateTime toDateTime(T dateTime) {
    try {
      @SuppressWarnings("unchecked") // Expected class.
      D dateObj = (D) PropertyUtils.getProperty(dateTime, "date");
      String timeZoneId =
          PropertyUtils.isReadable(dateTime, "timeZoneId")
              ? (String) PropertyUtils.getProperty(dateTime, "timeZoneId")
              : (String) PropertyUtils.getProperty(dateTime, "timeZoneID");
      return new DateTime(
          (Integer) PropertyUtils.getProperty(dateObj, "year"),
          (Integer) PropertyUtils.getProperty(dateObj, "month"),
          (Integer) PropertyUtils.getProperty(dateObj, "day"),
          (Integer) PropertyUtils.getProperty(dateTime, "hour"),
          (Integer) PropertyUtils.getProperty(dateTime, "minute"),
          (Integer) PropertyUtils.getProperty(dateTime, "second"),
          0,
          DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId)));
    } catch (IllegalAccessException e) {
      throw new IllegalStateException("Could not access class.", e);
    } catch (InvocationTargetException e) {
      throw new IllegalStateException("Could not get field.", e);
    } catch (NoSuchMethodException e) {
      throw new IllegalStateException("Could not get field.", e);
    }
  }
371361
def GetDate(self):
    
    normalized_timestamp = self._GetNormalizedTimestamp()
    if normalized_timestamp is None:
      return None, None, None

    number_of_days, _, _, _ = self._GetTimeValues(normalized_timestamp)

    try:
      return self._GetDateValuesWithEpoch(
          number_of_days, self._EPOCH_NORMALIZED_TIME)

    except ValueError:
      return None, None, None
425634
def _to_epoch(self, ts):
        

        year = self.year
        tmpts = "%s %s" % (ts, str(self.year))
        new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        # If adding the year puts it in the future, this log must be from last year
        if new_time > int(time.time()):
            year -= 1
            tmpts = "%s %s" % (ts, str(year))
            new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        return new_time
1005264
public static StringBuilder epochMillis(long timeMillis) {
        // 24 (human readable part) + 2 (parens) + 19 (max digits of a long integer)
        final StringBuilder buf = new StringBuilder(45);
        appendEpochMillis(buf, timeMillis);
        return buf;
    }
880320
public static int jodaToCalciteDate(final DateTime dateTime, final DateTimeZone timeZone)
  {
    final DateTime date = dateTime.withZone(timeZone).dayOfMonth().roundFloorCopy();
    return Days.daysBetween(DateTimes.EPOCH, date.withZoneRetainFields(DateTimeZone.UTC)).getDays();
  }
472989
public static String getTimestamp(Date time) {
        return getTimestampFormatter().format(time == null ? new Date() : time);
    }
773385
public static DateTime calciteDateToJoda(final int date, final DateTimeZone timeZone)
  {
    return DateTimes.EPOCH.plusDays(date).withZoneRetainFields(timeZone);
  }
999572
def convertDatetime(t):
    
    epoch = datetime.datetime.utcfromtimestamp(0)
    delta = t - epoch
    millis = delta.total_seconds() * 1000
    return int(millis)
540433
public final Date getTime(final Date start) {
        final Calendar cal;
        if (start instanceof net.fortuna.ical4j.model.Date) {
            cal = Dates.getCalendarInstance((net.fortuna.ical4j.model.Date)start);
        } else {
            cal = Calendar.getInstance();
        }

        cal.setTime(start);
        if (isNegative()) {
            cal.add(Calendar.WEEK_OF_YEAR, -weeks);
            cal.add(Calendar.DAY_OF_WEEK, -days);
            cal.add(Calendar.HOUR_OF_DAY, -hours);
            cal.add(Calendar.MINUTE, -minutes);
            cal.add(Calendar.SECOND, -seconds);
        }
        else {
            cal.add(Calendar.WEEK_OF_YEAR, weeks);
            cal.add(Calendar.DAY_OF_WEEK, days);
            cal.add(Calendar.HOUR_OF_DAY, hours);
            cal.add(Calendar.MINUTE, minutes);
            cal.add(Calendar.SECOND, seconds);
        }
        return cal.getTime();
    }
1036733
def parse_time(s):
    
    result = None

    if "epoch" in s:
        epoch_time = float(s.rstrip().split(' ')[1][:-1])
        result = datetime.datetime.utcfromtimestamp(epoch_time)
    else:
        _, date_part, time_part = s.split(' ')
        year, mon, day = date_part.split('/')
        hour, minute, sec = time_part.split(':')
        result = datetime.datetime(*map(int, (year, mon, day, hour, minute, sec)))

    return result
88065
public String getDateTime(long time) {

        return CmsDateTimeUtil.getDateTime(new Date(time), CmsDateTimeUtil.Format.SHORT);
    }
38193
def from_datetime(self, dt):
        
        global _last_timestamp

        epoch = datetime(1970, 1, 1, tzinfo=dt.tzinfo)
        offset = epoch.tzinfo.utcoffset(epoch).total_seconds() if epoch.tzinfo else 0
        timestamp = (dt  - epoch).total_seconds() - offset

        node = None
        clock_seq = None

        nanoseconds = int(timestamp * 1e9)
        timestamp = int(nanoseconds // 100) + 0x01b21dd213814000

        if clock_seq is None:
            import random
            clock_seq = random.randrange(1 << 14)  # instead of stable storage
        time_low = timestamp & 0xffffffff
        time_mid = (timestamp >> 32) & 0xffff
        time_hi_version = (timestamp >> 48) & 0x0fff
        clock_seq_low = clock_seq & 0xff
        clock_seq_hi_variant = (clock_seq >> 8) & 0x3f
        if node is None:
            node = getnode()
        return pyUUID(fields=(time_low, time_mid, time_hi_version,
                            clock_seq_hi_variant, clock_seq_low, node), version=1)
257183
public String getDateTime(long time) {

        return CmsDateUtil.getDateTime(new Date(time), DateFormat.SHORT, m_locale);
    }
798926
public static DateTime toDateTime(org.joda.time.DateTime dateTime) {
    return dateTimesHelper.toDateTime(dateTime);
  }
1015643
public static DateTime of(Date date) {
		if (date instanceof DateTime) {
			return (DateTime) date;
		}
		return new DateTime(date);
	}
733829
def __datetime_to_epoch(self, date_time):
        
        date_time_utc = None
        if date_time.tzinfo is None:
            date_time_utc = date_time.replace(tzinfo=pytz.utc)
        else:
            date_time_utc = date_time.astimezone(pytz.utc)

        epoch_utc = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)

        return (date_time_utc - epoch_utc).total_seconds()