Reputation: 4141
How to pass the current date to a query in mysql like such query:
select from Dailytimesheet dailytimesheet where dailytimesheet.TrackingDate="2010-05-03"
Upvotes: 1
Views: 1437
Reputation: 44192
In MySQL, you can use CURRENT_DATE
to get the current date.
mysql> select CURRENT_DATE;
+--------------+
| CURRENT_DATE |
+--------------+
| 2010-05-03 |
+--------------+
1 row in set (0.08 sec)
Using NOW()
works as well, but gets you the current date and time as a timestamp value. You can truncate it like DATE(NOW())
, but CURRENT_DATE
avoids the function call.
Upvotes: 4
Reputation: 1569
you can use the NOW() function within your SQL query to get the current timestamp.
Upvotes: 0