Python Time module

Source: Internet
Author: User

1 #examples of time module functions2 Import Time3 4 #gets the current time stamp5t =time.time ()6 Print('gets the current timestamp:', T)7 8 #struct_time form of the current time9t =time.localtime ()Ten Print('the Struct_time form of the current time:', T) One Print('Current Year:', T.tm_year) A  - #the string form of the current time -t =time.ctime () the Print('the string form of the current time:', T) -  - #string of the current time custom format -t = time.strftime ("%y-%m-%d%h:%m:%s", Time.localtime ()) + Print('string for the current time custom format:', T)

Operation Result:

1 Get current timestamp: 1501808069.95581722 struct_time form of current time: Time.struct_time (tm_year=2017, tm_mon=8, tm_ Mday=43                                              tm_hour=8, tm_min=54, tm_sec=294                                              tm_wday=4, tm_yday=216, tm_ isdst=0)5 Current year:6 string form of current time: Fri  4 08:54:297 Current time custom formatted string: 2017-08-04 08:54:29

Python Time module

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.