![]() |
VOOZH | about |
We can use Python datetime module to get the current date and time of the local system.
from datetime import datetime
# Current date time in local system
print(datetime.now())
Output: 2018-09-12 14:17:56.456080
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Java and Python Developer for 20+ years, Open Source Enthusiast, Founder of https://www.askpython.com/, https://www.linuxfordevices.com/, and JournalDev.com (acquired by DigitalOcean). Passionate about writing technical articles and sharing knowledge with others. Love Java, Python, Unix and related technologies. Follow my X @PankajWebDev
not working for me idk why
- Foka
Hello. I want to make print current time like mysql’s datetime format. example 2021-08-27 18:10:11 How to make it without 3rd party libraries?
- yolu
Uups, I need to setup something because after the “succesfull” installation of pytz and pendulum I get the same error: ModuleNotFoundError: No module named ‘pytz’ or ModuleNotFoundError: No module named ‘pendulum’ but when I try to run the install again I got the message “Requirement already satisfied: python-dateutil=2.6 in /usr/lib/python3/dist-packages (from pendulum) (2.7.3)”, similar with pytz module. Please give me a tip for fixing this. I have lubuntu 20.04 and Python 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0] on linux
- Juan Manuel Carrillo Campos
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.