Solved

datetimeoffset(5)) ?

Posted on 2011-03-23
6
488 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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