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')
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.
The Voice of the DBA Podcasts
We publish three versions of the podcast each day for you to enjoy.