Python: strftime()
strftime()
The strftime() function returns a string representing the date, controlled by an explicit format string. Format codes referring to hours, minutes or seconds will see 0 values.
Syntax:
date.strftime(format)
Complete list of formatting with examples:
Download the Notebook from here.
Test your Python skills with w3resource's quiz
Python: Tips of the Day
How to get the current time in Python:
>>> import datetime >>> datetime.datetime.now() datetime.datetime(2009, 1, 6, 15, 8, 24, 78915) >>> print(datetime.datetime.now()) 2009-01-06 15:08:24.789150
And just the time:
>>> datetime.datetime.now().time() datetime.time(15, 8, 24, 78915) >>> print(datetime.datetime.now().time()) 15:08:24.789150
Ref: https://bit.ly/30rAhY9
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework