zoukankan      html  css  js  c++  java
  • python time.striptime模块用法

                 python time模块中strptime用法

      

      time.strptime(string[, format])
      其中string参数即为要深入的日期字符串。format为格式化的日期字符串。
      

      

    %Y Year with century as a decimal number.
    %m Month as a decimal number [01,12].
    %d Day of the month as a decimal number [01,31].
    %H Hour (24-hour clock) as a decimal number [00,23].
    %M Minute as a decimal number [00,59].
    %S Second as a decimal number [00,61].
    %z Time zone offset from UTC.
    %a Locale's abbreviated weekday name.
    %A Locale's full weekday name.
    %b Locale's abbreviated month name.
    %B Locale's full month name.
    %c Locale's appropriate date and time representation.
    %I Hour (12-hour clock) as a decimal number [01,12].
    %p Locale's equivalent of either AM or PM

    该方法返回一个元组,structtime.


    | tm_gmtoff
    | offset from UTC in seconds
    |
    | tm_hour
    | hours, range [0, 23]
    |
    | tm_isdst
    | 1 if summer time is in effect, 0 if not, and -1 if unknown
    |
    | tm_mday
    | day of month, range [1, 31]
    |
    | tm_min
    | minutes, range [0, 59]
    |
    | tm_mon
    | month of year, range [1, 12]
    |
    | tm_sec
    | seconds, range [0, 61])
    |
    | tm_wday
    | day of week, range [0, 6], Monday is 0
    |
    | tm_yday
    | day of year, range [1, 366]
    |
    | tm_year
    | year, for example, 1993
    |
    | tm_zone
    | abbreviation of timezone name

     
  • 相关阅读:
    将数组扁平化并去除其中重复数据,最终得到一个升序且不重复的数组
    vue 设计一个倒计时秒杀的组件
    es6之三个点(...)扩展运算符
    es6之解构赋值
    es6之字符串添加的东西
    ES6系列之变量声明let const
    js对数组进行删除
    python学习
    泛型
    随笔
  • 原文地址:https://www.cnblogs.com/sugar-k/p/11560291.html
Copyright © 2011-2022 走看看