Python Gets the timestamp of the 0 o'clock in the morning of the day __python

Source: Internet
Author: User

Recently wrote Python, encountered a problem, need to get the day 0 o'clock in the morning time stamp, the internet really did not find, I handwritten a, a bit of a setback

#-*-Coding:utf-8-*-
import time

now_time = Int (Time.time ())
day_time = now_time-now_time% 86400 + time.t Imezone
day_time_str = Time.asctime (Time.localtime (day_time))
print day_time
print day_time_str

Import datetime Today
= Datetime.date.today ()
today_time = Int (time.mktime today.timetuple ())
print Today_time

The output is as follows:

1518105600

Fri Feb 9 00:00:00 2018

1518105600


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.