1

I am trying to get the current date by below python code

from datetime import date
currentdate = date.today()

This returns me the system date, so if I try to change the system date it returns the current date based on that. But I want to get the current date regardless of system date so that if we change the system date as well it should return me the current date. How can I achive this in python?

shee
  • 165
  • 1
  • 10

1 Answers1

2

You should get current time from outer source, like

r = requests.get('http://worldclockapi.com/api/json/utc/now').json()
print(r['currentDateTime']);
Rigorich
  • 74
  • 3