Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Convert GMT to BST

Author  Topic 

Starsky51
Starting Member

2 Posts

Posted - 2011-07-05 : 04:58:21
The data held in my table has a timestamp which is GMT. I need a bit of sql code that i can use that will convert the time to BST. I have done this in crystal, but am new to sql and am struggling to convert the code. It looks for the last Sunday in March and the last Sunday in October to assess whether to add the hour or not. Here is the crystal code I used :

if {Call_Fact.ReceivedDatetime} > date(year({Call_Fact.ReceivedDatetime}),3,31)-dayofweek(date(year({Call_Fact.ReceivedDatetime}),3,31)) then

(if {Call_Fact.ReceivedDatetime} <= date(year({Call_Fact.ReceivedDatetime}),10,31)-dayofweek(date(year({Call_Fact.ReceivedDatetime}),10,31))

then DateAdd ("n",60,{Call_Fact.ReceivedDatetime})

else {Call_Fact.ReceivedDatetime})

else {Call_Fact.ReceivedDatetime}


Hope somebody can help on this
Thanks

lappin
Posting Yak Master

182 Posts

Posted - 2011-07-05 : 06:17:09
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=28712
Go to Top of Page
   

- Advertisement -