
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Getting formatted time in Python
You can format any time as per your requirement, but simple method to get time in readable format is asctime() −
Example
#!/usr/bin/python import time; localtime = time.asctime( time.localtime(time.time()) ) print "Local current time :", localtime
Output
This would produce the following result −
Local current time : Tue Jan 13 10:17:09 2009
- Related Articles
- How to get formatted date and time in Python?
- Getting current time in Python
- Formatted text in Linux Terminal using Python
- Formatted string literals (f-strings) in Python?
- Formatted Output in Java
- Formatted output in C#
- Formatted string literals in C#
- Program to find the formatted amount of cents of given amount in Python
- Formatted Strings Using Template Strings in JavaScript
- Python Pandas - Return an Index of formatted strings specified by date format
- Getting calendar for a month in Python
- How to get formatted JSON in .NET using C#?
- Python - Getting started with SymPy module
- Python Getting sublist element till N
- Python Getting started with psycopg2-PostgreSQL

Advertisements