Skip to main content

SQL NOW() Function

Body

The NOW() function is an aggregate function used to return the date and time along with other column.

The NOW() function returns the result as dd/mm/yyyy HH:MM:SS AM/PM depending on your regional settings.

SQL NOW() Syntax

SELECT column_name(s),NOW() FROM Table

Consider the following table for this exercise

Users

Firstname Lastname Salary DeptID
John Smith 1000 1
Mathew Simon 3000 1
Bill Steve 2200 1
Amanda Rogers 1800 2
Steve Hills 2800 2
Steve jobs 2400 2
bill cosby 700 3

Example # 1

SELECT Salary, NOW() as TILL_date FROM Users

Result of the Query

Salary TILL_date
1000 23/03/2011 03:24:06 AM
3000 23/03/2011 03:24:06 AM
2200 23/03/2011 03:24:06 AM
1800 23/03/2011 03:24:06 AM
2800 23/03/2011 03:24:06 AM
2400 23/03/2011 03:24:06 AM
700 23/03/2011 03:24:06 AM

Comments

Submitted bybrave (not verified)on Sun, 04/01/2012 - 00:46

SIR,, CAN YOU HELP ME TO DEVELOP MY FINAL EXAM PROJECT .It has make library system using C# and SQL data base ONLY.So send me small source code and it data base pls.. emai:[email protected]

Add new comment