• python中时间日期格式化符号的含义


        • %y      两位数的年份表示(00-99)
        • %Y     四位数的年份表示(000-9999)
        • %m     月份(01-12)
        • %d      月内中的一天(0-31)
        • %H        24小时制小时数(0-23)
        • %I       12小时制小时数(01-12)
        • %M     分钟数(00=59)
        • %S      秒(00-59)
        • %a      本地简化星期名称
        • %A      本地完整星期名称
        • %b      本地简化的月份名称
        • %B      本地完整的月份名称
        • %c      本地相应的日期表示和时间表示
        • %j       年内的一天(001-366)
        • %p      本地A.M.或P.M.的等价符
        • %U     一年中的星期数(00-53)星期天为星期的开始
        • %w     星期(0-6),星期天为星期的开始
        • %W     一年中的星期数(00-53)星期一为星期的开始
        • %x     本地相应的日期表示
        • %X     本地相应的时间表示
        • %Z     当前时区的名称
        • %%     %号本身
    CodeMeaningExample
    %a Weekday as locale’s abbreviated name. Mon
    %A Weekday as locale’s full name. Monday
    %w Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. 1
    %d Day of the month as a zero-padded decimal number. 30
    %-d Day of the month as a decimal number. (Platform specific) 30
    %b Month as locale’s abbreviated name. Sep
    %B Month as locale’s full name. September
    %m Month as a zero-padded decimal number. 09
    %-m Month as a decimal number. (Platform specific) 9
    %y Year without century as a zero-padded decimal number. 13
    %Y Year with century as a decimal number. 2013
    %H Hour (24-hour clock) as a zero-padded decimal number. 07
    %-H Hour (24-hour clock) as a decimal number. (Platform specific) 7
    %I Hour (12-hour clock) as a zero-padded decimal number. 07
    %-I Hour (12-hour clock) as a decimal number. (Platform specific) 7
    %p Locale’s equivalent of either AM or PM. AM
    %M Minute as a zero-padded decimal number. 06
    %-M Minute as a decimal number. (Platform specific) 6
    %S Second as a zero-padded decimal number. 05
    %-S Second as a decimal number. (Platform specific) 5
    %f Microsecond as a decimal number, zero-padded on the left. 000000
    %z UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).  
    %Z Time zone name (empty string if the object is naive).  
    %j Day of the year as a zero-padded decimal number. 273
    %-j Day of the year as a decimal number. (Platform specific) 273
    %U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 39
    %W Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 39
    %c Locale’s appropriate date and time representation. Mon Sep 30 07:06:05 2013
    %x Locale’s appropriate date representation. 09/30/13
    %X Locale’s appropriate time representation. 07:06:05
    %% A literal '%' character. %
  • 相关阅读:
    Educational Codeforces Round 10 C. Foe Pairs 水题
    Educational Codeforces Round 10 B. z-sort 构造
    CDOJ 1048 Bob's vector 三分
    Educational Codeforces Round 10 A. Gabriel and Caterpillar 模拟
    第14届电子科大初赛民间盗版部分题目题解
    HDU 5654 xiaoxin and his watermelon candy 离线树状数组 区间不同数的个数
    HDU 5653 Bomber Man wants to bomb an Array. dp
    HDU 5652 India and China Origins 二分+并查集
    HDU 5651 xiaoxin juju needs help 数学
    HDU 5650 so easy 数学
  • 原文地址:https://www.cnblogs.com/wenbo4399/p/8490051.html
Copyright © 2020-2023  润新知