Answer simple quiz at the end of the blog post and –
Every day one winner from India will get Joes 2 Pros Volume 3.
Every day one winner from United States will get Joes 2 Pros Volume 3.
System and Time Data Types
Keeping track of date and time data points has always been a critical part of online transactional databases. For example, each sales invoice record needs a date-time stamp, as do systems which track quotes and customer contacts regarding sales opportunities.
Think of how many times during your workday that you rely on a date-time stamp as helpful metadata to sort or locate the latest information in a report or data source. Global organizations, in particular, have a need for their in-house communication, reporting, and collaboration tools to appropriately convey accurate date and time information in order to keep every part of the organization in sync.
Recap of DateTime Functions
GETDATE( ) and SELECT SYSDATETIME( ) both return the current date and time in your time zone. However, GETDATE( ) shows fractional seconds expressed in milliseconds (.333 second), and SYSDATETIME( ) shows fractional seconds expressed in nanoseconds (.3333333 second). SYSDATETIME( ) return similar results but their precisions differ.
What time is it right now in the UK? UTC is Coordinated Universal Time, formerly known as Greenwich Mean Time (GMT). (UTC is also known by the terms zulu time, world time, and universal time.)
SELECT GETUTCDATE( ) will show the current time expressed in terms of UTC. GETUTCDATE( ) is less precise than SYSUTCDATETIME ( ). However there is a UTC function that gets down to the nanoseconds, SYSUTCDATETIME( ). When we run all 4 of these functions together We see the two top times in my local time zone (in my case the Pacific time zone) and the two bottom times in UTC.
Question 16
Which one of the following functions will return the date and time in the current time zone to a precision of milliseconds?
- GETDATE( )
- SYSDATETIME( )
- GETUTCDATE( )
- SYSUTCDATETIME( )
Rules:
Please leave your answer in comment section below with correct option, explanation and your country of resident.
Every day one winner will be announced from United States.
Every day one winner will be announced from India.
A valid answer must contain country of residence of answerer.
Please check my facebook page for winners name and correct answer.
Winner from United States will get Joes 2 Pros Volume 3.
Winner from India will get Joes 2 Pros Volume 3.
The contest is open till next blog post shows up at which is next day GTM+2.5.
Reference:Â Pinal Dave (https://blog.sqlauthority.com)
100 Comments. Leave new
GETDATE()
sddesh
USA
Correct answer is # 1.
It displays the current time zone’s date and time with respect to the milliseconds format.
Option 1 GETDATE(): It returns the current date and time in your time zone. It shows fractional seconds expressed in milliseconds (.333 second).
Option 2 SYSDATETIME(): It returns the current date and time in your time zone. But it shows fractional seconds expressed in nanoseconds (.3333333 second).
Option 3 GETUTCDATE(): It will show the current time expressed in terms of UTC. GETUTCDATE( ) is less precise than SYSUTCDATETIME ( ).
Option 4 SYSUTCDATETIME(): It will show the current time expressed in terms of UTC and it gets down to the nanoseconds.
Gopalakrishnan Arthanarisamy
Unisys, Bangalore, India
Correct answer is # 1.
It displays the current time zone’s date and time with respect to the milliseconds format.
Option 1 GETDATE(): It returns the current date and time in your time zone. It shows fractional seconds expressed in milliseconds (.333 second).
Option 2 SYSDATETIME(): It returns the current date and time in your time zone. But it shows fractional seconds expressed in nanoseconds (.3333333 second).
Option 3 GETUTCDATE(): It will show the current time expressed in terms of UTC. GETUTCDATE( ) is less precise than SYSUTCDATETIME ( ).
Option 4 SYSUTCDATETIME(): It will show the current time expressed in terms of UTC and it gets down to the nanoseconds.
Gopalakrishnan Arthanarisamy
Unisys, Bangalore, India
Correct Answer is : Option 1 GETDATE()
— GVPrabu || BANGALORE || INDIA
Correct answer is Option #1
1.GETDATE()
becuase option #1 GETDATE() and #2 SYSDATETIME() returns date and time value with respect to CURRENT time zone, however, option #1 returns in fractional seconds expressed in milliseconds,
option #2 returns in fractional seconds expressed in nanoseconds.
Option #3 GETUTCDATE() and #4 SYSUTCDATETIME() returns the date and time value in UTC format., so these are incorrect.
Correct answer is Option #1
1.GETDATE()
becuase option #1 GETDATE() and #2 SYSDATETIME() returns date and time value with respect to CURRENT time zone, however, option #1 returns in fractional seconds expressed in milliseconds,
option #2 returns in fractional seconds expressed in nanoseconds.
Option #3 GETUTCDATE() and #4 SYSUTCDATETIME() returns the date and time value in UTC format., so these are incorrect.
Cochin,INDIA
Correct option is Option #1
GETDATE( )
SYSDATETIME() returns current time zone datetime upto nanoseconds which is not required.
Option #3 GETUTCDATE() and #4 SYSUTCDATETIME() return datetime in UTC format which is also not required.
Sumit
India
option one 1. GETDATE() is the right answer
because option 2 returns value in nonoseconds
option 3 and 4 gives value in utc date time
Tej Narayan Maurya
India
Correct answer is
Option 1- GETDATE( )
City:Baroda
Country: India
Thanks,
GurjitSingh
Hi,
Option #1 GetDate() is correct. It will return in nanosecods.
Thanks
Sudhir Chawla
India
Answer is 1;
SELECT GETDATE( )
GETDATE( ) shows fractional seconds expressed in milliseconds ,
and SYSDATETIME( ) shows fractional seconds expressed in nanoseconds
GETUTCDATE( ) will show the current time expressed in terms of UTC. SYSUTCDATETIME ( ) will show curretnt time gets down to the nanoseconds.
Answer is Option -1
GETDATE() will gives the correct date and time with the precission of milliseconds.
Thanks,
Narendra (India)
Correct Answer is option 1.
getdate() returns current time zone details with milliseconds precision.
Thanks,
Fazal
Correct Answer is option 1.
getdate() returns current time zone details with milliseconds precision.
Country:India
Thanks,
Fazal
Option 1 is correct. Because
1) GETDATE() returns a DATETIME value. A DATETIME value has precision upto 3 milliseconds.
2) SYSDATETIME() returns a DATETIME2 value. which gives precision upto 100nanoseconds
Thanks
Santosh.S
Bangalore
Answer 1 is Correct
because GETDATE( ) gives fractional seconds expressed in milliseconds
and GETUTCDATE( ) will show the current time expressed in milliseconds terms of UTC
Abhishek MIshra
INDIA NOIDA
Hi,
Option #1 GetDate() is correct. It will return in milliseconds not nanoseconds.
Thanks
Sudhir Chawla
India
Hi Sir,
Option 1 is the correct answer as GETDATE() will return the date and time in the current time zone to a precision of milliseconds (.333 second).
option 2 SYSDATETIME() will return the date and time in the current time zone to a precision of nanoseconds (.3333333 second).
Option 3 GETUTCDATE() will show the current time expressed in terms of UTC to a precision of milliseconds.
Option 4 SYSUTCDATETIME() will show the current time expressed in terms of UTC to a precision of nanoseconds.
So the correct answer is Option no 1 GETDATE().
P.Anish Shenoy,
INDIA, Bangalore, Karnataka
Correct Option is 1
i.e. 1) GETDATE() which gives date and time and the precision to milliseconds.
I’m from INDIA
The Correct answer is : #1
GETDATE( )
Mohd Thoufeek
chennai-india