Every line of 'python get unix timestamp' 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.
13 def timestamp(): 14 return calendar.timegm(pytz.utc.localize(datetime.datetime.utcnow()).timetuple())
140 def timestamp(): 141 now_time = datetime.now() 142 if PY3: 143 return now_time.timestamp() 144 else: 145 epoch = datetime.utcfromtimestamp(0) 146 total_seconds = (now_time - epoch).total_seconds() 147 # total_seconds will be in decimals (millisecond precision) 148 return total_seconds
92 def timestamp(): 93 """Return a timestamp string.""" 94 return str(datetime.datetime.now()).split('.')[0]
72 def from_timestamp(unixtime): 73 """ 74 Args: 75 unixtime (int): 76 77 Returns: 78 datetime.datetime: 79 80 """ 81 if not unixtime: 82 return None 83 84 return datetime.fromtimestamp(unixtime)
15 def _timestamp(): 16 return time.strftime('[%Y-%m-%d %H:%M:%S] ', time.localtime(time.time()))
31 def _timestamp(): 32 return time.strftime("%Y-%m-%d-%H-%M-%S".format(time.gmtime(time.time())))
8 def get_timestamp(): 9 """Returns string ISO 8601 with hours:minutes:seconds""" 10 return time.strftime("%Y-%m-%d %H:%M:%S")
175 def timestamp(): 176 return time.strftime("%a %b %d %H:%M:%S %Y")
84 def timestamp_to_unix(timestamp): 85 return str(int(timestamp))
35 def timestamp(): 36 """timestamp() -> str:timestamp 37 38 Returns a string of digits representing the current time. 39 """ 40 return str(int(time.time() * 1000000))