zoukankan      html  css  js  c++  java
  • time 与 data time

    >>> import datetime
    >>> datetime.datetime.now()
    datetime.datetime(2018, 5, 30, 15, 37, 12, 531883)
    >>> print (datetime.datetime.now())#当前现在的时间
    2018-05-30 15:37:35.631327
    >>> print(datetime.datetime.now() + datetime.timedelta())#当前现在的时间
    2018-05-30 15:38:52.390913
    >>> print(datetime.datetime.now() + datetime.timedelta(3))#当前现在的时间+3天的时间
    2018-06-02 15:38:58.598931
    >>> print(datetime.datetime.now() + datetime.timedelta(hours=3))#当前现在的时间+3个小时的时间
    2018-05-30 18:39:08.862841
    >>> print(datetime.datetime.now() + datetime.timedelta(minutes=3))#当前现在的时间+3分钟的时间
    2018-05-30 15:42:20.462443
    >>> print(datetime.datetime.now() + datetime.timedelta(-3))#当前现在的时间-3天的时间
    2018-05-27 15:39:31.558313
    >>> c_time = datetime.datetime.now()
    >>> c_time
    datetime.datetime(2018, 5, 30, 15, 39, 52, 134712)
    >>> print(c_time.replace(minute=3,hour=2))#当前现在的时间替换小时,分钟
    2018-05-30 02:03:52.134712
    >>> print(c_time)
    2018-05-30 15:39:52.134712

  • 相关阅读:
    Bootstrap-CL:警告
    Bootstrap-CL:略缩图
    Bootstrap-CL:页面标题
    Bootstrap-CL:超大屏幕
    Bootstrap-CL:徽章
    Bootstrap-CL:标签
    Bootstrap-CL:分页
    Bootstrap-CL:面包屑导航
    Bootstrap-CL:导航栏
    Bootstrap-CL:导航元素
  • 原文地址:https://www.cnblogs.com/xiaojuanzi666/p/9111607.html
Copyright © 2011-2022 走看看