Solved

datetimeoffset(5)) ?

Posted on 2011-03-23
6
502 Views
Last Modified: 2012-05-11
which means?
 SELECT
    CAST(GETDATE() AS datetimeoffset(5)) AS 'datetimeoffset'


datetimeoffset
2011-03-23 15:20:23.67000 +00:00
0
Comment
Question by:enrique_aeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 35202308
enrique_aeo,

What is your question with regards to the above?

Kevin
0
 

Author Comment

by:enrique_aeo
ID: 35202375
datetimeoffset(1)) ?
datetimeoffset(2)) ?
datetimeoffset(3)) ?
datetimeoffset(4)) ?

WHY I have no time difference to UTC?
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 350 total points
ID: 35202531
datetimeoffset is a date/time data type that is time zone aware.  The value that goes in the parenthesis determines the precision.

Your sample code just casts GETDATE() to datetimeoffset, but since GETDATE() only returns datetime the time zone part is not set (remains +00:00).

You should use the SYSDATETIMEOFFSET() to get your current time in datetimeoffset format:

     SELECT SYSDATETIMEOFFSET()

More info here:
http://msdn.microsoft.com/en-us/library/ms186724%28v=SQL.100%29.aspx

I hope this helps.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Assisted Solution

by:enrique_aeo
enrique_aeo earned 0 total points
ID: 35237824
ok, i execute
SELECT SYSDATETIMEOFFSET()
this is the results
2011-03-28 21:26:53.1630585 -05:00

what is the main means?
 -05:00
0
 
LVL 23

Assisted Solution

by:wdosanjos
wdosanjos earned 350 total points
ID: 35237869
-05:00 means that your system is 5 hours behind GMT.
0
 

Author Closing Comment

by:enrique_aeo
ID: 35308392
it is fine
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question