Monday, July 15, 2019

How to get the Date and Time of Current Location in Python





I want to get the Date and Time of The Current Location. If somebody runs the code in a different country thought it will show the date and and time for them, and not for me. If you know any commands for this please put the down bellow. I prefer If I don't need a library so that people who get the code don't need to download the library.


Answer



I think you can not get the date or time of a location.



This code gets your device's date and time:




from datetime import datetime
now = datetime.now()

current_time = now.strftime("%H:%M:%S")
current_date = now.strftime("%D")

print("Current Time: ", current_time)
print("Current Date: ", current_date)


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...