10 examples of 'python datetime now' in Python

Every line of 'python datetime now' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
98def Now():
99 """ current date and tile
100 """
101 return DateTime()

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

188def now():
189 """
190 Return an aware or naive datetime.datetime, depending on settings.USE_TZ.
191 """
192 if settings.USE_TZ:
193 # timeit shows that datetime.now(tz=utc) is 24% slower
194 return datetime.utcnow().replace(tzinfo=utc)
195 else:
196 return datetime.now()
36def now(cls):
37 return FAKE_NOW
24def getNow (): # Avoid operator overloading, which would result in the dysfunctional: __new__ __call__ (Date)
25 return __new__ (Date ())
32def date():
33 return datetime.now()
112def datenow():
113 try:
114 (Y, M, D, h, m, s, c, u) = time.localtime()
115 return '%d-%d-%d %d:%d:%d' % (Y, M, D, h, m, s)
116 except:
117 return time.time()
68def get_now_date():
69 """Return a datetime object of current time"""
70 return (datetime.datetime.utcnow()
71 .isoformat() + 'Z')
64def now():
65 return time.strftime("[%Y-%m-%d %X] ")
14def now(dt=False):
15 d = datetime.utcnow()
16 d = d.replace(tzinfo=pytz.utc)
17 if dt:
18 return d
19 else:
20 return int(d.strftime('%s'))
5def get_date_now():
6 return datetime.datetime.utcnow().isoformat()

Related snippets