>>> pad_timestamp('20')
    '209912'

    >>> pad_timestamp('2014')
    '201412'

    >>> pad_timestamp('20141011')
    '20141011'

    >>> pad_timestamp('201410110010')
    '201410110010'
779310
def pad_timestamp(string, pad_str=PAD_6_UP):
    

    str_len = len(string)
    pad_len = len(pad_str)

    if str_len < pad_len:
        string = string + pad_str[str_len:]

    return string
389600
function timestamp () {
  const date = new Date()

  return [
    zeropad(date.getHours()),
    zeropad(date.getMinutes()),
    zeropad(date.getSeconds())
  ].join(':')
}
189499
def date_time_string(timestamp=None):
    """"""
    global _last_date_time_string
    _last_timestamp, _last_str = _last_date_time_string
    if timestamp is None:
        timestamp = time.time()
    _curr_timestamp = int(timestamp)
    if _curr_timestamp == _last_timestamp:
        return _last_str
    else:
        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
        s = b"%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
                weekdayname[wd],
                day, monthname[month], year,
                hh, mm, ss)
        _last_date_time_string = (_curr_timestamp, s)
        return s
252075
def ms_to_timestamp(ms):
    """'"""
    # XXX throw on overflow/underflow?
    if ms < 0: ms = 0
    if ms > MAX_REPRESENTABLE_TIME: ms = MAX_REPRESENTABLE_TIME
    h, m, s, ms = ms_to_times(ms)
    return "%01d:%02d:%02d.%02d" % (h, m, s, ms//10)
1153096
def pretty_timestamp(timestamp, date_format='%a-%m_%d_%y:%H:%M:%S'):
    """"""
    return time.strftime(date_format,
                         time.localtime(int(str(timestamp)[:10])))
445290
def with_timestamps(self, created_at=None, updated_at=None):
        
        if not created_at:
            created_at = self.created_at()

        if not updated_at:
            updated_at = self.updated_at()

        return self.with_pivot(created_at, updated_at)
1086816
public static String padStartDateStr(String timestamp) {
		return boundTimestamp(padDigits(timestamp,LOWER_TIMESTAMP_LIMIT,
				UPPER_TIMESTAMP_LIMIT,LOWER_TIMESTAMP_LIMIT));
	}
1200741
def readable_timestamp(stamp):
    
    if date.fromtimestamp(stamp) == date.today():
        return str(datetime.fromtimestamp(stamp).strftime("%I:%M:%S%p"))
    else:
        return str(date.fromtimestamp(stamp))
1249311
def pp_timestamp(t):
    
    if t is None:
        return ''
    h, m, s = int(t / 3600), int(t / 60 % 60), t % 60
    return "%02d:%02d:%05.2f" % (h, m, s)
941030
def set_timestamp(self, timestamp=str(datetime.datetime.utcfromtimestamp(time.time()))):
        
        self.timestamp = timestamp
859346
def time_to_str(timestamp: int) -> str:
    
    datetimestamp = datetime.datetime.fromtimestamp(timestamp)
    return '{:04d}-{:02d}-{:02d}-{:02d}-{:02d}-{:02d}'.format(
            datetimestamp.year, datetimestamp.month, datetimestamp.day,
            datetimestamp.hour, datetimestamp.minute, datetimestamp.second
    )
367968
def display_timestamps_pair(time_m_2):
    
    if len(time_m_2) == 0:
        return '(empty)'

    time_m_2 = np.array(time_m_2)
    return '({}, {})'.format(
        display_timestamps(time_m_2[:, 0]),
        display_timestamps(time_m_2[:, 1]),
    )
349334
def format_index(prefix, timestamp, sep='-'):
        
        tz_info = tz.tzutc()

        # ex. logstash-other-2017.05.09
        return "{prefix}{sep}{date}".format(
            prefix=prefix, sep=sep, date=datetime.fromtimestamp(timestamp, tz=tz_info).strftime('%Y.%m.%d'))
1114662
function translateDateTimestamp(timestamp) {
    if (!timestamp) {
        LOG.warn("Received an invalid timestamp: {}", timestamp);
        return Date.now();
    }

    return new Date(timestamp);
}
455117
def timestamp(year, month=1, day=1,
              hour=0, minute=0, second=0, microsecond=None,
              off_hours=None, off_minutes=None,
              precision=None, fractional_precision=None):
    
    delta = None
    if off_hours is not None:
        if off_hours < -23 or off_hours > 23:
            raise ValueError('Hour offset %d is out of required range -23..23.' % (off_hours,))
        delta = timedelta(hours=off_hours)
    if off_minutes is not None:
        if off_minutes < -59 or off_minutes > 59:
            raise ValueError('Minute offset %d is out of required range -59..59.' % (off_minutes,))
        minutes_delta = timedelta(minutes=off_minutes)
        if delta is None:
            delta = minutes_delta
        else:
            delta += minutes_delta

    tz = None
    if delta is not None:
        tz = OffsetTZInfo(delta)

    if microsecond is not None:
        if fractional_precision is None:
            fractional_precision = MICROSECOND_PRECISION
    else:
        microsecond = 0
        if fractional_precision is not None:
            raise ValueError('Cannot have fractional precision without a fractional component.')

    return Timestamp(
        year, month, day,
        hour, minute, second, microsecond,
        tz, precision=precision, fractional_precision=fractional_precision
    )
1311537
def rfc_from_timestamp(timestamp):
    
    last_modified_date = datetime.utcfromtimestamp(timestamp)
    last_modified_str = last_modified_date.strftime(
        '%a, %d %b %Y %H:%M:%S GMT')
    return last_modified_str
1024564
def scan_timestamp(self, tbuf):
        ''''''
        while True:
            (tusec,) = struct.unpack('>Q', tbuf)
            t = tusec * 1.0e-6
            if abs(t - self._last_timestamp) <= 3*24*60*60:
                break
            c = self.f.read(1)
            if len(c) != 1:
                break
            tbuf = tbuf[1:] + c
        return t