Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

datetimeoffset(5)) ?

Posted on 2011-03-23
6
Medium Priority
?
528 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 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 1400 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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

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 1400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

885 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