Python datetime formatting Parameters

Source: Internet
Author: User

Sorry, I can't remember my memory. I have been using it for so long. I will record it here and try it later.

Directive Meaning Notes
% Locale's abbreviated weekdayname.  
% Locale's full weekday name.  
% B Locale's abbreviated monthname.  
% B Locale's full month name.  
% C Locale's appropriate date andtime representation.  
% D Day of the month as a decimalnumber [01,31].  
% F Microsecond as a decimalnumber [0, 999999], zero-paddedon the left (1)
% H Hour (24-hour clock) as adecimal number [00,23].  
% I Hour (12-hour clock) as adecimal number [01,12].  
% J Day of the year as a decimalnumber [001,366].  
% M Month as a decimal number [01,12].  
% M Minute as a decimal number [].  
% P Locale's equivalent of eitheram or PM. (2)
% S Second as a decimal number []. (3)
% U Week number Of The Year (Sunday as the first day ofthe week) as a decimal number []. All days in a newyear preceding the firstsunday are considered to be inweek 0. (4)
% W Weekday as a decimal number [0 (Sunday), 6].  
% W Week number Of The Year (Monday as the first day ofthe week) as a decimal number []. All days in a newyear preceding the firstmonday are considered to be inweek 0. (4)
% X Locale's appropriate daterepresentation.  
% X Locale's appropriate timerepresentation.  
% Y Year without century as adecimal number [].  
% Y Year with century as a decimalnumber.  
% Z UTC offset in the form + hhmmor-hhmm (empty string if thethe object is naive ). (5)
% Z Time zone name (empty stringif the object is naive ).  
% A literal'%'Character.  

Http://docs.python.org/library/datetime.html#strftime-strptime-behavior

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.