This article mainly introduces the datetime module in the python time module. The interface of the datetime module is more intuitive and easier to call, if you want to know about the datetime module, you can refer to Python to provide multiple built-
C # common Datetime skills,
C # common skills
// TodayDateTime. Now. Date. tow.datestring ();// Subtract one from yesterday, that is, today's dateDateTime. Now. AddDays (-1). tow.datestring ();// Tomorrow, similarly, add oneDateTime. Now. AddDays (1)
The DateTime class is used in. NET to process time-type data.First, the fieldMaxValue represents the maximum possible value for a DateTime. This field is read-only.MinValue represents the minimum possible value for a DateTime. This field is
Python provides several built-in modules for manipulating date times, like Calendar,time,datetime. Time module I have described in the previous article, it provides the interface and C standard library time.h basically consistent. The interface of
DateTime is the standard library for Python to process dates and times.Get the current date and timeLet's look at how to get the current date and time: from datetime import datetime>>> now = DateTime.Now () # Gets the current datetime>>> Print /c3>--
ObjectiveInterpretation of related termsThe manifestation of timeTime ModuleDateTime moduleTime Format CodeSummarizeObjectiveIn the development work, we often need to use the date and time, such as:Content output as log informationCalculate the
One time PackageSleep ([float time]) delays a number of seconds in floating-point numbersThe time package is based on the C language library function (functions).Python's interpreter is generally written in C, and some Python functions also call the
Objective
Python provides several built-in modules for manipulating date times, like Calendar,time,datetime. The interface provided by the time module is basically consistent with the C standard library time.h. The interface of the DateTime module
The DateTime module defines the following classes:Datetime.date: A class that represents a date. Common attributes are the year, month, Day.datetime.time: class that represents the time. Commonly used properties are hour, minute, second, Microsecond.
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.