• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(2100)  |  Call(1826)  |  Derive(0)  |  Import(274)
strptime(string, format) -> struct_time

Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as strftime()).

src/q/u/querychinesesto-HEAD/prog/gbk-encode-example.py   querychinesesto(Download)
print datetime.datetime.now()
print '日期类型', type(datetime.datetime.strptime('2008-02-06', '%Y-%m-%d'))
print '字符串类型', type(datetime.datetime.now().strftime('%Y-%m-%d'))
print 'struct类型', type(time.strptime('2008-02-06', '%Y-%m-%d'))
print 'utc: ', time.gmtime(), 'local: ', time.localtime()
print time.clock()
print time.time(), time.mktime(time.localtime()), time.time() == time.mktime(time.localtime())

src/e/d/Edwin-HEAD/scripts/jabber/doc/examples/logger.py   Edwin(Download)
def LOG(stanza,nick,text):
    ts=stanza.getTimestamp()
    if not ts:
        ts=stanza.setTimestamp()
        ts=stanza.getTimestamp()
    tp=time.mktime(time.strptime(ts,'%Y%m%dT%H:%M:%S %Z'))+3600*3
    if time.localtime()[-1]: tp+=3600

src/f/b/fb-commut-HEAD/trunk/ifaces/jabber-comm-remote/xmpppy-0.4.1/doc/examples/logger.py   fb-commut(Download)
def LOG(stanza,nick,text):
    ts=stanza.getTimestamp()
    if not ts:
        ts=stanza.setTimestamp()
        ts=stanza.getTimestamp()
    tp=time.mktime(time.strptime(ts,'%Y%m%dT%H:%M:%S %Z'))+3600*3
    if time.localtime()[-1]: tp+=3600

src/f/b/fb-commut-HEAD/ifaces/jabber-comm-remote/xmpppy-0.4.1/doc/examples/logger.py   fb-commut(Download)
def LOG(stanza,nick,text):
    ts=stanza.getTimestamp()
    if not ts:
        ts=stanza.setTimestamp()
        ts=stanza.getTimestamp()
    tp=time.mktime(time.strptime(ts,'%Y%m%dT%H:%M:%S %Z'))+3600*3
    if time.localtime()[-1]: tp+=3600

src/c/l/clearversion-HEAD/trunk/clearVersion/etc/subversion/hooks/examples/svn2feed.py   clearversion(Download)
    def _format_updated_ts(self, revision_ts):
 
        # Get "2006-08-10 20:17:08" from 
        # "2006-07-28 20:17:18 +0530 (Fri, 28 Jul 2006)
        date = revision_ts[0:19]
        epoch = time.mktime(time.strptime(date, "%Y-%m-%d %H:%M:%S"))
        return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(epoch))

src/c/l/clearversion-HEAD/clearVersion/etc/subversion/hooks/examples/svn2feed.py   clearversion(Download)
    def _format_updated_ts(self, revision_ts):
 
        # Get "2006-08-10 20:17:08" from 
        # "2006-07-28 20:17:18 +0530 (Fri, 28 Jul 2006)
        date = revision_ts[0:19]
        epoch = time.mktime(time.strptime(date, "%Y-%m-%d %H:%M:%S"))
        return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(epoch))

src/p/y/python-stategen-HEAD/examples/ical/icalpretty.py   python-stategen(Download)
            date_fmt = "%Y%m%dT%H:%M:%S"
        else:
            date_fmt = "%Y%m%dT%H%M%S"
        tm = time.strptime(_.value, date_fmt)
        utc = time.mktime(tm)
        if oldtz:
            os.environ['TZ'] = oldtz

src/s/t/streammine-HEAD/example_applications/Logger/LogStream.py   streammine(Download)
	lastTimeString = lastTokens[0] + " " + lastTokens[1] + " " + lastTokens[2]
 
 
	first = time.strptime(timeString, "%b %d %H:%M:%S")
	last = time.strptime(lastTimeString, "%b %d %H:%M:%S")
 
	totalTime = time.mktime(first) - time.mktime(last)

src/p/y/PyMT-0.5.1/examples/apps/mtwitter/twitter.py   PyMT(Download)
  def GetCreatedAtInSeconds(self):
    '''Get the time this status message was posted, in seconds since the epoch.
 
    Returns:
      The time this status message was posted, in seconds since the epoch.
    '''
    return time.mktime(time.strptime(self.created_at, '%a %b %d %H:%M:%S +0000 %Y'))
  def GetCreatedAtInSeconds(self):
    '''Get the time this direct message was posted, in seconds since the epoch.
 
    Returns:
      The time this direct message was posted, in seconds since the epoch.
    '''
    return time.mktime(time.strptime(self.created_at, '%a %b %d %H:%M:%S +0000 %Y'))

src/m/a/matplotlib-HEAD/py4science/examples/scrape_key_stats.py   matplotlib(Download)
        except ValueError: pass
 
        # try to convert to date
        try: y,m,d = time.strptime(x, '%d-%b-%y')[:3]
        except ValueError: pass
        else: return datetime.date(y,m,d)
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next