Solved

datetimeoffset(5)) ?

Posted on 2011-03-23
6
499 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
  • 3
  • 2
6 Comments
 
LVL 59

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
Independent Software Vendors: 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

Technology Partners: 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!

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 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