SQLServerCentral Editorial

Time Zones

,

I ran across this article on time zones, and was surprised that it was such a complex topic. It seemed to me that there should be an easy conversion function built into SQL Server that would do this:

DECLARE @dt datetime
SELECT @dt = GETDATE()
SELECT CONVERT( DATETIMEOFFSET, @dt, 'CST')

and I’d get my current time in Central Standard Time (CST).

It’s 2012. We’ve learned that time zones are a part of applications. SQL Server is built for work with web applications, which usually span time zones. Developers can code around this, but don’t we want to give them tools to save time? Isn’t that the whole idea behind Lightswitch, ORMs, and most of the new languages in the world? To make developers more productive?

CONVERT still has crazy numeric codes for conversion. Wouldn’t it make more sense to do this:

DECLARE @dt datetime
SELECT @dt = GETDATE()
SELECT CONVERT( datetime, @dt, 'dd.mm.yy')

than this?

DECLARE @dt datetime
SELECT @dt = GETDATE()
SELECT CONVERT( datetime, @dt, 104)

Time zone abbreviations are well known. Shouldn’t they be built into SQL Server?

Sometimes I wonder if we are looking too much into things we can add to an application rather than the things that we can improve. Especially those things we use constantly.

Steve Jones


The Voice of the DBA Podcasts

We publish three versions of the podcast each day for you to enjoy.

Everyday Jones

The podcast feeds are available at sqlservercentral.mevio.com. Comments are definitely appreciated and wanted, and you can get feeds from there. Overall RSS Feed: or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

You can also follow Steve Jones on Twitter:

Rate

3 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

3 (1)

You rated this post out of 5. Change rating