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

js to achieve the complete steps of Chinese to Pinyin conversion

I used js to create a package for converting Chin...

The use and difference between vue3 watch and watchEffect

1.watch listener Introducing watch import { ref, ...

HTML meta viewport attribute detailed description

What is a Viewport Mobile browsers place web pages...

Vue implements user login switching

This article example shares the specific code of ...

JavaScript adds event listeners to event delegation in batches. Detailed process

1. What is event delegation? Event delegation: Ut...

Detailed explanation of Truncate usage in MySQL

Preface: When we want to clear a table, we often ...

How to configure pseudo-static and client-adaptive Nginx

The backend uses the thinkphp3.2.3 framework. If ...

Installation tutorial of the latest stable version of MySQL 5.7.17 under Linux

Install the latest stable version of MySQL on Lin...

A brief discussion on the mysql execution process and sequence

Table of contents 1:mysql execution process 1.1: ...

ElementUI implements the el-form form reset function button

Table of contents Business scenario: Effect demon...

Detailed explanation of MySQL database index

Table of contents 1. Introduction to MySQL Index ...

Tomcat+Mysql high concurrency configuration optimization explanation

1.Tomcat Optimization Configuration (1) Change To...