The time module for Python

Source: Internet
Author: User

1 #Encoding=utf-82 Import Time3 4 #return Timestamp5 Printtime.time ()6 7 #The delayed operating unit is S, with the following delay of 3s8Time.sleep (3)9 Ten #convert timestamp to time tuple (time object), from 1970+second, whose second is seconds One PrintTime.gmtime (4) A  - #convert timestamp to local object - Printtime.localtime () the  - #converting a timestamp to a string - PrintTime.asctime (Time.localtime ()) -  + #converting a timestamp to a string - PrintTime.ctime (5) +  A #convert local time to timestamp att = (2009, 2, 17, 17, 3, 38, 1, 48, 0) - Printtime.mktime (t) -  - #converts a time object to a canonical string (commonly used) in the following format - " " - %Y year with century as a decimal number. in %m Month as a decimal number [01,12]. - %d day of the month as a decimal number [01,31]. to %H Hour (24-hour clock) as a decimal number [00,23]. + %M Minute as a decimal number [00,59]. - %s Second as a decimal number [00,61]. the %z time zone offset from UTC. * %a Locale ' s abbreviated weekday name. $ %A Locale ' s full weekday name.Panax Notoginseng %b Locale ' s abbreviated month name. - %B Locale ' s full month name. the %c Locale ' s appropriate date and time representation. + %I Hour (12-hour clock) as a decimal number [01,12]. A %p Locale ' s equivalent of either AM or PM. the " " + PrintTime.strftime ('%y-%m-%d%h-%m-%s', T) -  $ #converts a time string to an array of time based on a specified format character $Struct_time = Time.strptime ("From the Nov","%d%b%y") - PrintStruct_time

The time module for Python

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.