Convert all MongoTimestamp object to time.
543390
public function convertMongoTimestamp()
    {
        $this->createdAt = ($this->createdAt instanceof \MongoTimestamp) ? $this->createdAt->sec : $this->createdAt;
        $this->updatedAt = ($this->updatedAt instanceof \MongoTimestamp) ? $this->updatedAt->sec : $this->updatedAt;

        foreach ($this->getTranslations() as $translation) {
            $translation->convertMongoTimestamp();
        }
    }
460162
function toTimestamp(scale, input) {
	var adapter = scale._adapter || defaultAdapter;
	var options = scale.options.time;
	var parser = options.parser;
	var format = parser || options.format;
	var value = input;

	if (typeof parser === 'function') {
		value = parser(value);
	}

	// Only parse if its not a timestamp already
	if (typeof value !== 'number' && !(value instanceof Number) || !isFinite(value)) {
		value = typeof format === 'string'
			? adapter.parse(value, format)
			: adapter.parse(value);
	}

	if (value !== null) {
		return +value;
	}

	// Labels are in an incompatible format and no `parser` has been provided.
	// The user might still use the deprecated `format` option for parsing.
	if (!parser && typeof format === 'function') {
		value = format(input);

		// `format` could return something else than a timestamp, if so, parse it
		if (typeof value !== 'number' && !(value instanceof Number) || !isFinite(value)) {
			value = adapter.parse(value);
		}
	}

	return value;
}
117545
public static Timestamp toTimestamp(DateTime dt) {
        if (dt == null) {
            return null;
        } else {
            return new Timestamp(dt.getMillis());
        }
    }
370320
def iso8601timestamp(T=None, nanos=True, utc=False):
	""""""
	T  = time.time() if T is None else T
	Ti = math.floor(T)
	Tn = round((T-Ti)*1e9)
	if Tn >= 1e9:
		Ti += 1
		Tn  = 0
	
	s  = time.gmtime(Ti)      if utc   else time.localtime(Ti)
	f  = time.strftime("%Y%m%dT%H%M%S", s)
	n  = ".{:09d}".format(Tn) if nanos else ""
	tz = "Z"                  if utc   else time.strftime("%z", s)
	return f+n+tz
591651
def to_timestamp(self, data):
        
        result = pd.Series(index=data.index)
        _slice = ~data[self.col_name].isnull()

        result[_slice] = data[_slice][self.col_name].astype('int64')
        return result
1281645
function DBTimeStamp($ts, $isfld = false)
	{

		if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
		if (is_object($ts)) $ds = $ts->format($this->fmtDate);
		else $ds = adodb_date($this->fmtTimeStamp,$ts);
		return 'TO_DATE('.$ds.",'RRRR-MM-DD, HH:MI:SS AM')";
	}
522584
def execute_cast_timestamp_to_timestamp(op, data, type, **kwargs):
    """"""
    input_timezone = data.tz
    target_timezone = type.timezone

    if input_timezone == target_timezone:
        return data

    if input_timezone is None or target_timezone is None:
        return data.tz_localize(target_timezone)

    return data.tz_convert(target_timezone)
639084
def fromtimestamp(cls, timestamp):
    """"""
    d = cls.utcfromtimestamp(timestamp)
    return d.astimezone(localtz())
554596
def normalize_time(timestamp):
    """"""
    offset = timestamp.utcoffset()
    if offset is None:
        return timestamp
    return timestamp.replace(tzinfo=None) - offset
771477
def execute_cast_simple_literal_to_timestamp(op, data, type, **kwargs):
    """"""
    return pd.Timestamp(data, tz=type.timezone)
227480
protected function _timeToMongoDate($time)
    {
        if(!is_numeric($time)) {
            $time = strtotime($time);
            if(!$time) {
                $time = time();
            }
        }
        
        return new \MongoDate($time);
    }
1374815
def _convert(value, tzto, defaulttz):
    """"""
    if not isinstance(value, datetime):
        raise ValueError('value must be a datetime.datetime object')

    if value.tzinfo is None:
        value = value.replace(tzinfo=defaulttz)

    return value.astimezone(tzto)
1271968
def timetopythonvalue(time_val):
    ""
    if isinstance(time_val, sequence):
        return map(timetopythonvalue, time_val)
    elif isinstance(time_val, numeric):
        return datetime.datetime(*(time.gmtime(time_val))[:6])
    elif isinstance(time_val, numeric):
        values = []
        try:
            values = map(long, time_val.split(","))
        except:
            pass
        if values:
            return map(timetopythonvalue, values)
    raise ValueError(repr(time_val))
808562
def ToTimedelta(self):
    """"""
    return timedelta(
        seconds=self.seconds, microseconds=_RoundTowardZero(
            self.nanos, _NANOS_PER_MICROSECOND))
1367010
def _time_from_json(value, field):
    """"""
    if _not_null(value, field):
        if len(value) == 8:  # HH:MM:SS
            fmt = _TIMEONLY_WO_MICROS
        elif len(value) == 15:  # HH:MM:SS.micros
            fmt = _TIMEONLY_W_MICROS
        else:
            raise ValueError("Unknown time format: {}".format(value))
        return datetime.datetime.strptime(value, fmt).time()
17298
function toTimestamp(date) {
    var value =
        (typeof date === 'number') ? date :           // number
        (date instanceof Date)     ? date.valueOf() : // Date
        new Date(date).valueOf();                     // ISOString, momentjs, ...

    if (isNaN(value)) {
      throw new TypeError('Invalid date ' + JSON.stringify(date) + '. ' +
          'Date, number, or ISOString expected');
    }

    return value;
  }
584583
def to_datetime(timestamp):
    """"""
    return dt.fromtimestamp(time.mktime(
        time.localtime(int(str(timestamp)[:10]))))