current position:Home>Get the current time in Python
Get the current time in Python
2022-05-15 05:49:33【A small pit of goods】
python Get the current time
python
Built in modules time
, You can get the current time , Make records to facilitate the use of replication method when writing code . """ @Description: Get the current time """
import time
def get_now_datetime():
""" @Description: Return current time , The format is : Mm / DD / yyyy HHM / S """
return time.strftime('%Y-%m-%d-%H_%M_%S',time.localtime(time.time()))
def get_now_time():
""" @Description: Return current time , The format is : Minutes and seconds """
return time.strftime('%H-%M-%S',time.localtime(time.time()))
def get_now_date():
""" @Description: Return current time , The format is : Specific date """
return time.strftime('%Y-%m-%d',time.localtime(time.time()))
if __name__=='__main__':
print(get_now_datetime())
print(get_now_date())
print(get_now_time())
copyright notice
author[A small pit of goods],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/135/202205142240049532.html
The sidebar is recommended
- Build Python project in Jenkins, pychar output is normal and Jenkins output modulenotfounderror: no module named problem
- Interface request processing of Python webservice
- Download third-party libraries offline in Python
- Web automation in Python
- Importlib.exe in Python import_ Module import module
- Operation of OS Library in Python
- Some integration operations on Web pages in Python
- Python realizes the super fast window screenshot, automatically obtains the current active window and displays the screenshot
- Implementation of workstation monitoring system with Python socket
- Resume Automation - word 92
guess what you like
Django foundation -- 02 small project based on Database
Python drawing word cloud
Django foundation -- 02 small project based on Database
MNIST dataset classification based on Python
Design of FTP client server based on Python
Signing using RSA algorithm based on Python
Website backend of online book purchase function based on Python
Implementation of Tetris game based on Python greedy search
Django Foundation
Case: Python weather broadcast system, this is a rainy day
Random recommended
- Python development alert notification SMS alert
- How to configure Python environment library offline in FME
- Python: fastapi - beginner interface development
- Generate password based on fast token and fast token
- [Django CI system] use of json-20220509
- [Django CI system] if the front-end date is complete, it will be fully updated to the back-end; If the front-end date is incomplete, the date will not be updated to the back-end-20220510
- [Django CI system] echarts dataset standard writing - 20220509
- [Django CI system] obtain the current time, the first day and the last day of the month, etc. - 20220510
- wxPython wx. Correction of font class · Wx Font tutorial
- NCT youth programming proficiency level test python programming level 3 - simulation volume 2 (with answers)
- Design of personal simple blog system based on Django (with source code acquisition method)
- [Python Script] classify pictures according to their definition
- Wu Enda's classic ml class is fully upgraded! Update to Python implementation and add more intuitive visual teaching
- Six built-in functions called immortals in Python
- Some insights of pandas in machine learning
- Introduction to Python [preliminary knowledge] - programming idea
- Stay up late to tidy up! Pandas text processing Encyclopedia
- Python recursion to find values by dichotomy
- Open 3D Python Interface
- [true title 02 of Blue Bridge Cup] Python output natural number youth group analysis of true title of Blue Bridge Cup Python national competition
- Introduction to the differences between Python and Java
- Explain Python CONDA in detail
- The pycham downloaded by MAC reports an error as soon as it is opened. The downloaded Python interpreter is also the latest version
- From entry to mastery, python full stack engineers have personally taught Python core technology and practical combat for ten years
- Python is used to detect some problems of word frequency in English text.
- How to choose between excel, database and pandas (Python third-party library)?
- WxPython download has been reporting errors
- Pyside6 UIC and other tools cannot be found in the higher version of pyside6 (QT for Python 6). How to solve it?
- About Python Crawlers
- Successfully imported pandas, unable to use dataframe
- How to extract some keywords in the path with Python
- Python encountered a problem reading the file!
- When Python is packaged into exe, an error is reported when opening assertionerror: C: \ users \ Acer \ appdata \ local \ temp\_ MEI105682\distutils\core. pyc
- Eight practical "no code" features of Python
- Python meets SQL, so a useful Python third-party library appears
- 100 Python algorithm super detailed explanation: a hundred dollars and a hundred chickens
- [fundamentals of Python] Python code and so on
- When Python uses probit regression, the program statement is deleted by mistake, and then it appears_ raise_ linalgerror_ Unrecognized error of singular
- Python testing Nicholas theorem
- Accelerating parallel computing based on python (BL) 136