Is the time here in Greenwich? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is the time here in Greenwich?

from datetime import datetime print(datetime.today()) My code here to check it out: https://code.sololearn.com/ctj14RQ8U5Ys/?ref=app Thank you for your help😊💕✨💗

23rd May 2019, 9:18 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
6 Answers
+ 3
Instead of parsing the time manually, you can just use datetime.today().hour <= this tells me that it's 21:40 (9:40 PM), your code says 22:40 but it's really 23:40 CEST, so I think it's Greenwich - 1 hour (UTC)
23rd May 2019, 9:42 PM
Anna
Anna - avatar
+ 3
When I made it offline it is working correctly,but after I have posted it everyone say same time then I said maybe in Greenwich I search in Google I saw the time in my code same time in Greenwich so I asked to make it sure
23rd May 2019, 9:46 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
23rd May 2019, 9:51 PM
Tahir Iqbal
Tahir Iqbal - avatar
+ 2
here's a one line solution print(time.asctime(time.localtime(time.time())))
24th May 2019, 7:40 AM
Shen Bapiro
Shen Bapiro - avatar
+ 1
Tahir Iqbal send it again
23rd May 2019, 10:44 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
23rd May 2019, 10:50 PM
Tahir Iqbal
Tahir Iqbal - avatar