
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Getting current time in Python
To translate a time instant from a seconds since the epoch floating-point value into a time-tuple, pass the floating-point value to a function (e.g., localtime) that returns a time-tuple with all nine items valid.
Example
#!/usr/bin/python import time; localtime = time.localtime(time.time()) print "Local current time :", localtime
Output
This would produce the following result, which could be formatted in any other presentable form −
Local current time : time.struct_time(tm_year=2013, tm_mon=7, tm_mday=17, tm_hour=21, tm_min=26, tm_sec=3, tm_wday=2, tm_yday=198, tm_isdst=0)
- Related Questions & Answers
- Getting formatted time in Python
- How to get current time in milliseconds in Python?
- Python program to find difference between current time and given time
- How to return the current CPU time in Python?
- How to get current date and time in Python?
- Getting the type of the current instance in C#
- Forming the nearest time using current time in JavaScript
- How to print current date and time using Python?
- Get current time information in Java
- Current Date and Time in Perl
- MySQL - Insert current date/time?
- Java Program to display Current Time in another Time Zone
- Get current date/time in seconds - JavaScript?
- How to set current time to some other time in JavaScript?
- Getting the unique identifier for the current managed thread in C#
Advertisements