Return the time that the message was originally published.

        Returns:
            datetime: The date and time that the message was published.
179374
def publish_time(self):
        
        timestamp = self._message.publish_time
        delta = datetime.timedelta(
            seconds=timestamp.seconds, microseconds=timestamp.nanos // 1000
        )
        return datetime_helpers._UTC_EPOCH + delta
1117725
def asDateTime(self):
        
        text = str(self)
        if text.endswith('Z'):
            tzinfo = TimeMixIn.UTC
            text = text[:-1]

        elif '-' in text or '+' in text:
            if '+' in text:
                text, plusminus, tz = string.partition(text, '+')
            else:
                text, plusminus, tz = string.partition(text, '-')

            if self._shortTZ and len(tz) == 2:
                tz += '00'

            if len(tz) != 4:
                raise error.PyAsn1Error('malformed time zone offset %s' % tz)

            try:
                minutes = int(tz[:2]) * 60 + int(tz[2:])
                if plusminus == '-':
                    minutes *= -1

            except ValueError:
                raise error.PyAsn1Error('unknown time specification %s' % self)

            tzinfo = TimeMixIn.FixedOffset(minutes, '?')

        else:
            tzinfo = None

        if '.' in text or ',' in text:
            if '.' in text:
                text, _, ms = string.partition(text, '.')
            else:
                text, _, ms = string.partition(text, ',')

            try:
                ms = int(ms) * 1000

            except ValueError:
                raise error.PyAsn1Error('bad sub-second time specification %s' % self)

        else:
            ms = 0

        if self._optionalMinutes and len(text) - self._yearsDigits == 6:
            text += '0000'
        elif len(text) - self._yearsDigits == 8:
            text += '00'

        try:
            dt = dateandtime.strptime(text, self._yearsDigits == 4 and '%Y%m%d%H%M%S' or '%y%m%d%H%M%S')

        except ValueError:
            raise error.PyAsn1Error('malformed datetime format %s' % self)

        return dt.replace(microsecond=ms, tzinfo=tzinfo)
1370799
def cover_time(date):
    
    datestr = str(date)[0:8]
    date = time.mktime(time.strptime(datestr, '%Y%m%d'))
    return date
690955
def QA_util_datetime_to_strdatetime(dt):
    
    strdatetime = "%04d-%02d-%02d %02d:%02d:%02d" % (
        dt.year,
        dt.month,
        dt.day,
        dt.hour,
        dt.minute,
        dt.second
    )
    return strdatetime
937085
def date(self, field=None, val=None):
        
        return self.datetime(field=field, val=val).date()
69507
def _datetime(self):
        
        if 'dt' not in self._cache.keys():
            self._cache['dt'] = self.MJD_T0 + timedelta(days=self._d, seconds=self._s)
        return self._cache['dt']
948260
def date(self):
        """"""
        if self.commit_time:
            return datetime.utcfromtimestamp(self.commit_time)
        else:
            return datetime.now()
8527
def get_published_date_metadata(self):
        
        # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
        metadata = dict(self._mdata['published_date'])
        metadata.update({'existing_date_time_values': self._my_map['publishedDate']})
        return Metadata(**metadata)
807697
def get_timestamp(dt=None):
    '''
    
    '''

    if dt is None: dt = datetime.datetime.utcnow()
    t = dt.utctimetuple()

    return calendar.timegm(t)
948463
def last_modified(self):
        ''''''
        lm = self.response.headers.get('last-modified', None)
        return datetime.strptime(lm, '%a, %d %b %Y %H:%M:%S GMT') if lm \
            else None
281211
def date(self):
        
        date = self.message.get('date')
        conv = None

        try:
            conv, _ = convert_mail_date(date)
        finally:
            return conv
444692
def value_from_message(self, message):
        
        message = super(DateTimeField, self).value_from_message(message)
        if message.time_zone_offset is None:
            return datetime.datetime.utcfromtimestamp(
                message.milliseconds / 1000.0)

        # Need to subtract the time zone offset, because when we call
        # datetime.fromtimestamp, it will add the time zone offset to the
        # value we pass.
        milliseconds = (message.milliseconds -
                        60000 * message.time_zone_offset)

        timezone = util.TimeZoneOffset(message.time_zone_offset)
        return datetime.datetime.fromtimestamp(milliseconds / 1000.0,
                                               tz=timezone)
310048
def creation_time(self):
        
        logs = self._query_logs()
        time_string = logs[-1].find('div', class_='zm-item-meta').time[
            'datetime']
        return datetime.strptime(time_string, "%Y-%m-%d %H:%M:%S")
495781
def datetime(self):
        
        date_string = '%s %s' % (self._date, self._year)
        date_string = re.sub(r' \(\d+\)', '', date_string)
        return datetime.strptime(date_string, '%A, %b %d %Y')
373555
def publish_date(self, publish_date):
        
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        publish_date = self._utils.format_datetime(publish_date, date_format='%Y-%m-%dT%H:%M:%SZ')

        self._data['publishDate'] = publish_date
        request = {'publishDate': publish_date}
        return self.tc_requests.update(self.api_type, self.api_sub_type, self.unique_id, request)
890952
def _get_time_override(self):
        

        if callable(self.time_override):
            time_override = self.time_override()
        else:
            time_override = self.time_override

        if not isinstance(time_override, datetime_time):
            raise ValueError(
                'Invalid type. Must be a datetime.time instance.'
            )

        return time_override
1240662
def QA_util_get_order_datetime(dt):
    

    #dt= datetime.datetime.now()
    dt = datetime.datetime.strptime(str(dt)[0:19], '%Y-%m-%d %H:%M:%S')

    if QA_util_if_trade(str(dt.date())) and dt.time() < datetime.time(15, 0, 0):
        return str(dt)
    else:
        # print('before')
        # print(QA_util_date_gap(str(dt.date()),1,'lt'))
        return '{} {}'.format(
            QA_util_date_gap(str(dt.date()),
                             1,
                             'lt'),
            dt.time()
        )