- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to check if a timestamp is set in MySQL?
Let us first create a table −
mysql> create table DemoTable855(DueDate timestamp); Query OK, 0 rows affected (0.54 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable855 values('2019-08-07'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable855 values('0000-00-00'); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable855 values('2019-07-06'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable855 values('2016-04-10'); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable855;
This will produce the following output −
+----------------------+ | DueDate | +----------------------+ | 2019-08-07 00 −00 −00| | 0000-00-00 00 −00 −00| | 2019-07-06 00 −00 −00| | 2016-04-10 00 −00 −00| +----------------------+ 4 rows in set (0.00 sec)
Following is the query to check if a timestamp is set in MySQL −
mysql> select *from DemoTable855 where DueDate > 0;
This will produce the following output −
+----------------------+ | DueDate | +----------------------+ | 2019-08-07 00 −00 −00| | 2019-07-06 00 −00 −00| | 2016-04-10 00 −00 −00| +----------------------+ 3 rows in set (0.03 sec)
- Related Articles
- How to check if a cookie is set in Laravel?
- How to check if a set is a subset of another set in R?
- How to add a “created at” column in a table to set the timestamp in MySQL?
- Set current date and time to timestamp in MySQL
- How to check if data is NULL in MySQL?
- PHP - How to use $timestamp to check if today is Monday or 1st of the month?
- How to convert from Unix timestamp to MySQL timestamp value?
- How to check if a MySQL database exists?
- Convert MySQL timestamp to UNIX Timestamp?
- How to order by timestamp in MySQL?
- Java Program to Check if a set is the subset of another set
- In MySQL stored procedures, how to check if a local variable is null?
- How to update a Timestamp and set to current date in MongoDB?
- How to convert timestamp to datetime in MySQL?
- How to check if a date has passed in MySQL?

Advertisements