Other functions Python-time packet

A, time package

1. Function: sleep (second)

(1) Meaning: the program is the number of seconds into hibernation

(2) Format: time.sleep (int num)

Other functions Python-time packet

2. function: strftime ()

(1) meaning: our timestamp represented as time format we want

(2) Format: time.strftime (timestamp)

(3) Return Value Type: String

(4) Character Meaning:

% Y represents two-digit year (00-99)

% Y represents a four-digit year (000-9999)

% M (01-12)

Within a% d day of the month (0-31)

% H 24 hours (0-23) manufactured by h

% I 12 hours hour (01-12)

% M number of minutes (00 = 59)

% S seconds (00-59)

% A week simplify local name

% A full weekday name local

% B local simplify month name

% B Full month name of the local

% C represents the corresponding date and time represent the local

One day (001-366)% j years

% P local AM or PM equivalent character

% U week number of the year (00-53) for the week beginning Sunday

% W week (0-6), Sunday is the start of week

% W week number of the year (00-53) for the week beginning Monday

% X indicates the corresponding local date

% X indicates the corresponding local time

Name% Z current time zone

%%% Number itself

Other functions Python-time packet

Two, datetime module

Provide the date and time of operation and representation.

1.date

(1) Meaning: a desired date and to provide year, month, day properties

(2)格式:datetime.date(year,month,day)

(3) Return Value: returns a string date

(4) Note: The property is added .year, .month, .day

d5 = datetime.date(2018,3,3)

print(d5)

print(d5.year)

print(d5.month)

print(d5.day)

在学习过程中有什么不懂得可以加我的
python学习资源qun,855-408-893
群里有不错的学习视频教程、开发工具与电子书籍。
与你分享python企业当下人才需求及怎么从零基础学习好python,和学习什么内容

Other functions Python-time packet

Guess you like

Origin blog.51cto.com/14568144/2446076