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

Posts les plus consultés de ce blog

Men kijan pou voye MINUT NATCOM-NATCOM pou ZANMIW an 3 etap

Comment partager des minutes sur natcom

Men kijan pou prete kob, minutes, lajan nan men NATCOM Ayiti