Every line of 'get epoch time python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
101 def epoch2datetime(epoch): 102 return datetime.datetime.utcfromtimestamp(epoch)
111 def filetime_to_epoch(filetime): 112 return int(filetime / 10000000 - 11644473600)
470 def _to_epoch_time(date): 471 """Convert a `datetime` object to an integer number of seconds since 472 the (local) Unix epoch. 473 """ 474 epoch = datetime.fromtimestamp(0) 475 delta = date - epoch 476 return int(delta.total_seconds())
27 def milliseconds_since_epoch(): 28 return int(time.time() * 1000)
267 @staticmethod 268 def epochfromtime(t): 269 return calendar.timegm(t)
54 def totimestamp(inputdate, epoch=datetime(1970,1,1)): 55 dt = datetime.strptime(inputdate, '%Y-%m-%d') 56 td = dt - epoch 57 timestamp = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 1e6 # td.total_seconds() 58 return int(timestamp)
13 def timestamp(): 14 return calendar.timegm(pytz.utc.localize(datetime.datetime.utcnow()).timetuple())