亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Python實(shí)現(xiàn)根據(jù)日期獲取當(dāng)天凌晨時(shí)間戳的方法示例

 更新時(shí)間:2019年04月09日 09:23:34   作者:xuezhangjun  
這篇文章主要介紹了Python實(shí)現(xiàn)根據(jù)日期獲取當(dāng)天凌晨時(shí)間戳的方法,涉及Python針對(duì)日期與時(shí)間戳的相關(guān)轉(zhuǎn)換、運(yùn)算等操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Python實(shí)現(xiàn)根據(jù)日期獲取當(dāng)天凌晨時(shí)間戳的方法。分享給大家供大家參考,具體如下:

# -*- coding:utf-8 -*-
#! python2
'''
Created on 2019年4月9日
@author: Administrator
'''
import datetime
import time
def get_day_zero_time(date):
  """根據(jù)日期獲取當(dāng)天凌晨時(shí)間"""
  if not date:
    return 0
  date_zero = datetime.datetime.now().replace(year=date.year, month=date.month,
                         day=date.day, hour=0, minute=0, second=0)
  date_zero_time = int(time.mktime(date_zero.timetuple()))
  return date_zero_time
# 今天的日期
today_date = datetime.datetime.now().date()
# 今天的零點(diǎn)
today_zero_time = get_day_zero_time(today_date)
#print today_date
print today_zero_time

運(yùn)行結(jié)果:

1554739200

PS:這里再為大家推薦幾款關(guān)于日期與天數(shù)計(jì)算的在線工具供大家使用:

在線日期/天數(shù)計(jì)算器:
http://tools.jb51.net/jisuanqi/date_jisuanqi

在線萬(wàn)年歷日歷:
http://tools.jb51.net/bianmin/wannianli

在線陰歷/陽(yáng)歷轉(zhuǎn)換工具:
http://tools.jb51.net/bianmin/yinli2yangli

Unix時(shí)間戳(timestamp)轉(zhuǎn)換工具:
http://tools.jb51.net/code/unixtime

更多關(guān)于Python相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Python日期與時(shí)間操作技巧總結(jié)》、《Python數(shù)學(xué)運(yùn)算技巧總結(jié)》、《Python數(shù)據(jù)結(jié)構(gòu)與算法教程》、《Python Socket編程技巧總結(jié)》、《Python函數(shù)使用技巧總結(jié)》、《Python字符串操作技巧匯總》及《Python入門與進(jìn)階經(jīng)典教程

希望本文所述對(duì)大家Python程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論