/python_programming

Python repository

Primary LanguageJupyter Notebook

Python

Datetime date format with strftime()

import datetime
dt = datetime.date.today()
Format Result
%m/%d/%Y 09/21/2015
%d/%m/%Y 21/09/2015
%Y-%m-%d 2015-09-21
%I:%M %p 08:58 AM
%b %d %Y Sep 21 2015
%d %B, %Y 21 September, 2015
%c Mon, Sep 21 2015 08:58:12 (Locale Appropriate DateTime)
%x 09/21/15 (Locale Appropriate Date)
%X 08:58:12  (Locale Appropriate Time)
%B%Y Sep2018