MySQL example of getting today and yesterday's 0:00 timestamp

MySQL example of getting today and yesterday's 0:00 timestamp

As shown below:

Yesterday: UNIX_TIMESTAMP(CAST(SYSDATE() AS DATE) - INTERVAL 1 DAY)

Today: UNIX_TIMESTAMP(CAST(SYSDATE() AS DATE))

To query today's records, you only need to have a timestamp whose creation time is greater than or equal to 0:00 today (only when there is no creation time greater than today). Yesterday's records are greater than or equal to 0:00 yesterday and less than 0:00 today.

The above example of how to get the 0:00 timestamp of today and yesterday in MySQL is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL statement to get all dates or months in a specified time period (without setting stored procedures or adding tables)
  • How to use MySQL DATEDIFF function to get the time interval between two dates
  • Mysql timeline data to obtain the first three data of the same day
  • Detailed explanation of MySQL to obtain statistical data for each day and each hour of a certain period of time
  • mysql gets yesterday's date, today's date, tomorrow's date, and the time of the previous hour and the next hour
  • mysql obtains statistical data within a specified time period
  • How to get time in mysql

<<:  How to use ss command instead of netstat in Linux operation and maintenance

>>:  Nginx's practical method for solving cross-domain problems

Recommend

Front-end advanced teaching you to use javascript storage function

Table of contents Preface Background Implementati...

Several ways to manually implement HMR in webpack

Table of contents 1. Introduction 2. GitHub 3. Ba...

How to start Vue project with M1 pro chip

Table of contents introduction Install Homebrew I...

Detailed explanation of Vue Notepad example

This article example shares the specific code of ...

The front end creates and modifies CAD graphics details through JavaScript

Table of contents 1. Current situation 2. Create ...

MySQL query tree structure method

Table of contents MySQL query tree structure 1. A...

A brief introduction to MySQL database optimization techniques

A mature database architecture is not designed wi...

Comparison of storage engines supported by MySQL database

Table of contents Storage Engine Storage engines ...

The implementation principle of Tomcat correcting the JDK native thread pool bug

To improve processing power and concurrency, Web ...

Detailed explanation of location and rewrite usage in nginx

1. Summary of location usage Location can locate ...

Detailed explanation of MySQL covering index

concept If the index contains all the data that m...