Display current DATETIME form MYSQL database using Select command
Let's say we have a database called atest and a table called atest with a column called DateT with those date values:
+---------------------+
| DateT |
+---------------------+
| 2018-10-05 13:53:34 |
| 2018-10-04 00:00:00 |
+---------------------+
We know want to display with SELECT command the first date time with is: 2018-10-05 13:53:34
Here is the query for that:
select * from atest where DateT >= cast((now()) as date)and DateT< cast((now() + interval 1 day) as date);
And if you have a column which is DATE only use this query:
select * from atest where DateT = CAST(CURRENT_TIMESTAMP AS DATE) ;
Commentaires
Enregistrer un commentaire