Every line of 'linux convert epoch to date' 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)
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())
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)
111 def filetime_to_epoch(filetime): 112 return int(filetime / 10000000 - 11644473600)