Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to do date time formatting with strftime in python

from datetime import datetime
now = datetime.now()
print(now.strftime("%d %B %Y %A"))
Comment

Python Format date using strftime()

from datetime import datetime

# current date and time
now = datetime.now()

t = now.strftime("%H:%M:%S")
print("time:", t)

s1 = now.strftime("%m/%d/%Y, %H:%M:%S")
# mm/dd/YY H:M:S format
print("s1:", s1)

s2 = now.strftime("%d/%m/%Y, %H:%M:%S")
# dd/mm/YY H:M:S format
print("s2:", s2)
Comment

PREVIOUS NEXT
Code Example
Python :: python change character in string 
Python :: how to use h5 file in python 
Python :: python lists as dataframe rows 
Python :: get token from request django 
Python :: copy file python 
Python :: python convert images to pdf 
Python :: print 2 decimal places python 
Python :: django sessions 
Python :: data compression in python 
Python :: view all columns in pandas dataframe 
Python :: python del 
Python :: simple graph in matplotlib categorical variables 
Python :: how to execute bash commands in python script 
Python :: turn a list into a string python 
Python :: connect to spark cluster 
Python :: python array get index 
Python :: __new__ python 
Python :: trim starting space python 
Python :: odoo change admin password from database 
Python :: how to run python module every 10 sec 
Python :: numpy random in python 
Python :: how to set variable in flask 
Python :: tkinter button hide 
Python :: how to make a list a string 
Python :: run matlab code in python 
Python :: python tkinter get image size 
Python :: python opencv subtract two images 
Python :: python dict setdefault 
Python :: Convert two lists into a dictionary in python 
Python :: python invert an array 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =