Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get date and time formatted python

import time
print(time.strftime("%Y-%m-%d_%H-%M-%S"))
Comment

Python Datetime Format

# Python program to demonstrate strftime() function
from datetime import datetime as date

# Getting current date and time
now = date.now()
print("Without formatting", now)

# Example 1
s = now.strftime("%A %m %-Y")
print('
Example 1:', s)

# Example 2
s = now.strftime("%a %-m %y")
print('
Example 2:', s)

# Example 3
s = now.strftime("%-I %p %S")
print('
Example 3:', s)

# Example 4
s = now.strftime("%H:%M:%S")
print('
Example 4:', s)
Comment

PREVIOUS NEXT
Code Example
Python :: django custom primary key field 
Python :: pyspark case when 
Python :: display Surface quit 
Python :: ffmpeg python cut video 
Python :: popup window python tkinter 
Python :: raise python 
Python :: link python to python3 
Python :: pandas print all columns 
Python :: export a dataframe to excel pandas 
Python :: python get computer name 
Python :: legend of colorbar python 
Python :: python get response headers 
Python :: pandas remove item from dictionary 
Python :: FileExistsError: [Errno 17] File exists: 
Python :: smtp email template 
Python :: Get a random joke in python 
Python :: display video in jupyter notebook 
Python :: pandas merge dataframes by column 
Python :: how to make a randomized pasword genirator in python 
Python :: pandas create new column and fill with constant value 
Python :: how to add subplots for histogram 
Python :: join two dictionaries python 
Python :: generic type python 
Python :: how to make images in python 
Python :: modulus of python complex number 
Python :: tkinter radio buttons 
Python :: timeit jupyter 
Python :: simple http server python 
Python :: replace values of pandas column 
Python :: check pandas version 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =