The time module for Python

Source: Internet
Author: User
Tags local time month name

The time module was used in the recent exercise, so I learned about the time module in detail.

Import time after help to see a detailed description of the time module

You can see that time has two representations:

One, time stamp notation

That is, an integer or floating-point type represents a time interval in seconds. The base value for this time is calculated from 0 o'clock on January 1 in 1970.

Two, tuple format notation

That is, a python data structure representation. This tuple has 9 integral types of content. Each represents a different time meaning. If the tuple items are

where DST (daylight Savings time) flag ( -1, 0, or 1) is the daylight saving date format, 0: Indicates normal format, 1: is expressed as daylight saving, 1: Indicates based on the current datetime format

There are two of the proper nouns:

UTC (coordinated Universal time, world co-ordination) is GMT, world standard Time. In China for Utc+8.
DST (daylight saving time) is daylight saving time. is a system for saving energy and artificially set local time, usually early in the morning in the summer for one hour ahead of time. (detailed explanation asked Niang)

Variable:

Method:

Format symbols supported by the time string:

format meaning remarks

  %a local (locale) simplified week name  %a Local full week name   %b Local simplified month name   %b Local full month name   %c Local corresponding date and time representation   
%h hours of the day (24-hour, 00-23) %i hours (12-hour, 01-12)%j (001-366)%m month (01-12 )%m minutes ( 00-59) for the first days of the year c13/>%p local AM or PM's corresponding character %s seconds (01-61) %u week of the year. (00-53 weeks is the beginning of one weeks.) All days before the first Sunday are placed in the No. 0 week. %w One weeks of the day (0-6,0 is Sunday) %w and%u are basically the same, the difference is%w with Monday for one weeks start. %x Local corresponding date %x local corresponding time %y remove the year of the Century (00-99) %y full year %z time zone name (if not present as a null character) percent '% ' character
What you need to know:

Other than that:
It's very useful to learn English well! Very useful! Very useful!

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.