Getting the Universal Time - GMT
Select GetDate() as LocalTime
Select GetUTCDate() as GMT_Time
GetUTCDate Returns the datetime value representing the current UTC time (Coordinated Universal Time or Greenwich Mean Time)
Select DateDiff(second,GetDate(),GetUTCDate() ) as DifferenceinSec
will give you the difference between GMT and your Local Time
Showing posts with label DateDiff. Show all posts
Showing posts with label DateDiff. Show all posts
Monday, April 16, 2007
GetAge - Get Age Using SQL Query
How to calculate Age using SQL Query
DateDiff function can be used to get the Age from the birth date
Select BirthDate, DateDiff(year, BirthDate, getdate()) as Age from HumanResources.Employee
DateDiff function can be used to get the Age from the birth date
Select BirthDate, DateDiff(year, BirthDate, getdate()) as Age from HumanResources.Employee
Subscribe to:
Posts (Atom)