Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss Content Posted by Steve Jones
»
Time Zone
25 posts, Page 1 of 3
1
2
3
»
»»
Time Zone
Rate Topic
Display Mode
Topic Options
Author
Message
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Monday, January 09, 2012 9:22 PM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 11:20 AM
Points: 31,437,
Visits: 13,752
Comments posted to this topic are about the item
Time Zone
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1232897
SQLRNNR
SQLRNNR
Posted Monday, January 09, 2012 9:22 PM
SSCoach
Group: General Forum Members
Last Login: 2 days ago @ 10:25 AM
Points: 18,754,
Visits: 12,337
EZ PZ
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1232898
bitbucket-25253
bitbucket-25253
Posted Monday, January 09, 2012 10:09 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 12:39 PM
Points: 5,103,
Visits: 20,220
Easy QODs at the beginning of the week ... now what confusing, complex, obscure QOD will Steve post for Friday ?
If everything seems to be going well, you have obviously overlooked something.
Ron
Please help us, help you -before posting a question please
read
Before posting a performance problem please
read
Post #1232907
tommyh
tommyh
Posted Monday, January 09, 2012 11:33 PM
UDP Broadcaster
Group: General Forum Members
Last Login: Friday, May 10, 2013 3:15 AM
Points: 1,476,
Visits: 1,943
I have never needed to store information about Timezones so excuse me if this is a stupid question. But wouldnt it be easier to store this in a separate column? I mean lets say i use this for say logging and we for some reason need to find all entries in a specific timezone. If you have 2 columns thats easy but with this datatype... how would you do that? (got no 2008 db to test on so
)
/T
Post #1232929
Hugo Kornelis
Hugo Kornelis
Posted Tuesday, January 10, 2012 12:50 AM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 3:49 PM
Points: 5,244,
Visits: 7,063
The benefit of storing it in a single column is that you can now easily compare two time stamps. With two columns, questions such as "is Jan 10 2012, 8:43 +01:00 earlier or later than Jan 9 2012, 23:50 -08:00?". You can even calculate how far these two time stamps are apart (7 minutes) by using the DATEDIFF function.
Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog:
http://sqlblog.com/blogs/hugo_kornelis
Post #1232960
Britt Cluff
Britt Cluff
Posted Tuesday, January 10, 2012 5:48 AM
SSCommitted
Group: General Forum Members
Last Login: Wednesday, October 24, 2012 8:17 PM
Points: 1,558,
Visits: 247
Yeah, another semi-easy point. Thanks for submitting.
http://brittcluff.blogspot.com/
Post #1233096
Mike Is Here
Mike Is Here
Posted Tuesday, January 10, 2012 5:58 AM
Ten Centuries
Group: General Forum Members
Last Login: 2 days ago @ 6:23 AM
Points: 1,331,
Visits: 433
Nice and easy.... and useful.
Post #1233098
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Tuesday, January 10, 2012 7:26 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 11:20 AM
Points: 31,437,
Visits: 13,752
tommyh (1/9/2012)
I have never needed to store information about Timezones so excuse me if this is a stupid question. But wouldnt it be easier to store this in a separate column? I mean lets say i use this for say logging and we for some reason need to find all entries in a specific timezone. If you have 2 columns thats easy but with this datatype... how would you do that? (got no 2008 db to test on so
)
/T
Hugo has pointed out the best reason, it also allows you to easily compare or work with all the rows in that column. If you have people entering data from different time zones, this allows you to easily store all the data in a correct chronological fashion, and the clients can easily convert to their local time without an issue.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1233207
Cliff Jones
Cliff Jones
Posted Tuesday, January 10, 2012 7:43 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 3:56 PM
Points: 3,400,
Visits: 3,411
Good question. This is useful.
Post #1233229
mtassin
mtassin
Posted Tuesday, January 10, 2012 8:56 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 1:57 AM
Points: 3,231,
Visits: 64,391
It is also nice when you want to look at all the values relative to your current timezone. For instance, all the logging data goes into the table from the various servers in their timezone. Well, I have trouble thinking about what time 14:00:00 +7:00 is, but I can just do SWITCHOFFSET(-6*60,<datetimefield>) and have it in my time zone.
SWITCHOFFSET is a very nice function when it comes to DATETIMEOFFSET and I wish we'd had it and DATETIMEOFFSET as far back as SQL 6. The oddball things I have to do to work with datetime data and handle things like Daylight savings time, and timezone variations magically go away for me with DATETIMEOFFSET.
--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
Post #1233309
« Prev Topic
|
Next Topic »
25 posts, Page 1 of 3
1
2
3
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.