Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python datetime module

import datetime as d
time = d.datetime.now()
time = time.strftime("%Y-%m-%d  %H:%M:%S")
           #year-#month-#date  #hour:#minure:#second
print(time)
Comment

datetime library

#date and time in a mm/dd/yyyy hh:mm:ss format
from datetime import datetime
now = datetime.now()


print('%02d/%02d/%04d %02d:%02d:%02d' % (now.month, now.day, now.year, now.hour, now.minute, now.second))
Comment

PREVIOUS NEXT
Code Example
Python :: extract zip file in python zipfile 
Python :: formatted string python 
Python :: python date range 
Python :: multiclass ROC AUC curve 
Python :: django include all columns admin show 
Python :: python to run another code on timer while a separate code runs 
Python :: plot using matplotlib 
Python :: run streamlit from python 
Python :: snakeCase 
Python :: how to set background image in python tkinter 
Python :: Using Python Permutations function on a String 
Python :: async sleep python 
Python :: get value and key from dict python 
Python :: numpy sort 
Python :: pandas rename column values dictionary 
Python :: python float to decimal 
Python :: python retry 
Python :: ssl django nginx 
Python :: how to save an image with the same name after editing in python pillow module 
Python :: get random float in range python 
Python :: iter() python 
Python :: Date Time split in python 
Python :: drop list of columns pandas 
Python :: python define an array of dictonary 
Python :: find the index of a character in a string python 
Python :: python xml to csv 
Python :: count unique elements in list python 
Python :: what does int do in python 
Python :: python code to exe file 
Python :: wintp python manage.py createsuperuser 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =