August 6, 2011 at 4:38 am
Hello,
We want to implement the timezone functionality through out the application.
Here, the data fields will be saved in the DB in UTC date format and when you present those fields in the application they should be converted into the actual timezone.
Here one more constraint should be taken... Day light Saving Time should be updated as per the current DST timings. (How to achieve DST from DB side)
Here my question is, which is the better way to implement this functionality through out the application?
from Database side or application side?
Please Suggest 🙂
Regards
Ganesh Kumar
GaNeSH
August 6, 2011 at 4:54 am
In SQL Server 2005, you should handle this on the client side. In SQL Server 2008 and greater, you could use DATETIME2 data type which can also manage time zones.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 6, 2011 at 4:57 am
Grant Fritchey (8/6/2011)
In SQL Server 2008 and greater, you could use DATETIME2 data type which can also manage time zones.
DateTimeOffset, not DateTime2.
Doesn't handle daylight saving though.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 6, 2011 at 5:02 am
GilaMonster (8/6/2011)
Grant Fritchey (8/6/2011)
In SQL Server 2008 and greater, you could use DATETIME2 data type which can also manage time zones.DateTimeOffset, not DateTime2.
Doesn't handle daylight saving though.
Oh crud. Of course. Sorry about that. And I was just writing about this in the new book. I knew that. Coffee hasn't kicked in yet.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 6, 2011 at 6:24 am
Grant Fritchey (8/6/2011)
GilaMonster (8/6/2011)
Grant Fritchey (8/6/2011)
In SQL Server 2008 and greater, you could use DATETIME2 data type which can also manage time zones.DateTimeOffset, not DateTime2.
Doesn't handle daylight saving though.
Oh crud. Of course. Sorry about that. And I was just writing about this in the new book. I knew that. Coffee hasn't kicked in yet.
No worries, I think she adjusted 4-5 of my replies this week (conservative estimate). 😉
August 6, 2011 at 7:40 am
Ninja's_RGR'us (8/6/2011)
Grant Fritchey (8/6/2011)
GilaMonster (8/6/2011)
Grant Fritchey (8/6/2011)
In SQL Server 2008 and greater, you could use DATETIME2 data type which can also manage time zones.DateTimeOffset, not DateTime2.
Doesn't handle daylight saving though.
Oh crud. Of course. Sorry about that. And I was just writing about this in the new book. I knew that. Coffee hasn't kicked in yet.
No worries, I think she adjusted 4-5 of my replies this week (conservative estimate). 😉
And as long as she doesn't need to do that at precon this year, I think you'll have a full recovery... of whatever's bruised right now :w00t:.
August 6, 2011 at 9:36 am
SQL Dev-938873 (8/6/2011)
Hello,We want to implement the timezone functionality through out the application.
Here, the data fields will be saved in the DB in UTC date format and when you present those fields in the application they should be converted into the actual timezone.
Here one more constraint should be taken... Day light Saving Time should be updated as per the current DST timings. (How to achieve DST from DB side)
Here my question is, which is the better way to implement this functionality through out the application?
from Database side or application side?
Please Suggest 🙂
Regards
Ganesh Kumar
Timezone is complex time interval arithmetic dependent on politicians like when George Bush gave Indiana money to join daylight savings time. There are clean defined classes in .NET 3.5 and up so use .NET, I am not aware of such classes in Java because somebody has to do the math.
Kind regards,
Gift Peddie
August 7, 2011 at 11:20 pm
Thanks for ur replies..
Can plz suggest... which is better from SQL Server or From Front End (.Net)????
GaNeSH
August 8, 2011 at 5:53 am
SQL Dev-938873 (8/7/2011)
Thanks for ur replies..Can plz suggest... which is better from SQL Server or From Front End (.Net)????
A couple of us have said it. The front end.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply