In SQL, NOW() function is used to return the current system date and time.
NOW() Syntax
SELECT NOW() FROM table_name;
We have a table "employee" as below:
employee
id first_name last_name salary
.......................................................
1 John Simp 10000
2 Chris Hely 25000
3 Joy Roy 20000
4 Jenny Mill 35000
NOW() Example
The below query selects the first_name and salary for today from the "employee" table:
SELECT first_name,salary,NOW() as current_date FROM employee;
Result:
first_name salary current_date
.......................................................
John 10000 1/1/2016 8:51:25 AM
Chris 25000 1/1/2016 8:51:25 AM
Joy 20000 1/1/2016 8:51:25 AM
Jenny 35000 1/1/2016 8:51:25 AM
Hope this will help you :)
0 Comment(s)