Convert container export value to timestamp value type
428280
private Timestamp convertFieldValueToTimestamp(final Field field,
                                                   final ExportContainer exportContainer) {
        if (field.getType().equals(LocalDateTime.class)) {
            return convertToTimestamp(parseDateTime(exportContainer.getExportValue()));
        } else if (field.getType().equals(LocalDate.class)) {
            return convertToTimestamp(parseDate(exportContainer.getExportValue()));
        } else if (field.getType().equals(LocalTime.class)) {
            return convertToTimestamp(parseTime(exportContainer.getExportValue()));
        } else if (field.getType().equals(Date.class)) {
            return convertToTimestamp(parseSimpleDateLong(exportContainer.getExportValue()));
        } else if (field.getType().equals(Timestamp.class)) {
            return Timestamp.valueOf(exportContainer.getExportValue());
        }
        return null;
    }
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
128956
def convert_timestamps(obj):
    
    for key in ('date', 'when', 'end', 'start_date', 'end_date'):
        value = obj.get(key)
        if value:
            try:
                obj[key] = _timestamp_to_dt(value)
            except TypeError:
                raise TypeError("expected float for %s, got %s" % (key, value))

    for key in ('sources', 'actions', 'votes', 'roles'):
        for child in obj.get(key, []):
            convert_timestamps(child)

    return obj
1280076
def proto_ts_from_datetime_str(dt):
    

    ts = Timestamp()
    if (dt is not None):
        try:
            ts.FromJsonString(dt)
        except ParseError:
            pass
    return ts
333541
def ts_to_dt_str(ts, dt_format='%Y-%m-%d %H:%M:%S'):
    
    return datetime.datetime.fromtimestamp(int(ts)).strftime(dt_format)
828497
def _GetTimeValue(self, name):
    
    timestamp = getattr(self._tsk_file.info.meta, name, None)

    if self._file_system_type in self._TSK_HAS_NANO_FS_TYPES:
      name_fragment = '{0:s}_nano'.format(name)
      fraction_of_second = getattr(
          self._tsk_file.info.meta, name_fragment, None)
    else:
      fraction_of_second = None

    return TSKTime(timestamp=timestamp, fraction_of_second=fraction_of_second)
75981
async def container_dump(self, container, container_type, params=None, obj=None):
        
        elem_type = x.container_elem_type(container_type, params)
        obj = [] if not x.has_elem(obj) else x.get_elem(obj)

        # todo: pod container, just concat blobs / serialized content together. loading = size / elem size...
        if container is None:  # todo: reconsider
            return NoSetSentinel()  # if not self.modelize else ArrayModel(obj, xmr_type_to_type(elem_type))

        for idx, elem in enumerate(container):
            try:
                self.tracker.push_index(idx)
                fvalue = await self._dump_field(elem, elem_type, params[1:] if params else None)
                self.tracker.pop()

            except Exception as e:
                raise helpers.ArchiveException(e, tracker=self.tracker) from e

            if not isinstance(fvalue, NoSetSentinel):
                obj.append(fvalue)

        return obj if not self.modelize else ArrayModel(obj, xmr_type_to_type(elem_type))
899681
def TimestampToRDFDatetime(timestamp):
  """"""
  # TODO(hanuszczak): `timestamp` should be of MySQL type `Decimal`. However,
  # it is unclear where this type is actually defined and how to import it in
  # order to have a type assertion.
  if timestamp is None:
    return None
  else:
    micros = int(1000000 * timestamp)
    return rdfvalue.RDFDatetime.FromMicrosecondsSinceEpoch(micros)
385131
def _timestamp_to_json_row(value):
    
    if isinstance(value, datetime.datetime):
        value = _microseconds_from_datetime(value) * 1e-6
    return value
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')";
	}
1114662
function translateDateTimestamp(timestamp) {
    if (!timestamp) {
        LOG.warn("Received an invalid timestamp: {}", timestamp);
        return Date.now();
    }

    return new Date(timestamp);
}
61812
def to_ts(date: datetime.date) -> float:
    
    return datetime.datetime(
        date.year, date.month, date.day,
        tzinfo=datetime.timezone.utc).timestamp()
909862
def to_timestamp(self, value):
        
        if isinstance(value, (six.integer_types, float, six.string_types)):
            try:
                return int(value)
            except ValueError:
                value = self.datetime_str_to_datetime(value)

        if isinstance(value, datetime.datetime):
            if timezone.is_aware(value):
                value = timezone.localtime(value, timezone.utc)
            return self._datetime_to_timestamp(value)

        raise exceptions.ValidationError(
            "Unable to convert value: '%s' to timestamp" % value,
            code="invalid_timestamp"
        )
1244835
function convertTime(value, fromUnit, toUnit)
{
    if(fromUnit != toUnit && value !== 0)
    {
        return value * (toUnit == 's'? 0.001 : 1000);
    }
    return value;
}
698418
private static long getTimeStamp(ClassNode cls) {
        if (!(cls instanceof DecompiledClassNode)) {
            return Verifier.getTimestamp(cls.getTypeClass());
        }

        return ((DecompiledClassNode) cls).getCompilationTimeStamp();
    }
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)
648576
def convert_timestamp(timestamp):
    """"""
    timestamp = timestamp.strip()
    chunk, millis = timestamp.split(',')
    hours, minutes, seconds = chunk.split(':')
    hours = int(hours)
    minutes = int(minutes)
    seconds = int(seconds)
    seconds = seconds + hours * 60 * 60 + minutes * 60 + float(millis) / 1000
    return seconds