|
|
|
date: Thu, 26 Jun 2008 05:57:02 -0700,
group: microsoft.public.sqlserver.mseq
back
Re: Getdate()+ so many hours
Brian,
But what is the effect of Daylight Savings Time on your application? I ask
without doing all the research necessary to actually understand how US and
UK daylight savings time relate or fail to relate. 6 hours is easy, but 5
hours is not so easy by using decimals. (0.208333333333333...). So, I
actually would suggest using DATEADD for date arithmatic.
However, it may be that GETUTCDATE() would serve you better in this case.
RLF
"Brian" wrote in message
news:71AA0EF5-E3AC-498D-9300-FCF96DC56979@microsoft.com...
> This worked perfectly. I just worked out the difference was actually + 6
> hours so I changed it to GETDATE()+0.25 and it seems to work a treat.
>
> Thanks a million!
>
> Brian
>
>
> "Russell Fields" wrote:
>
>> Brian,
>>
>> DATEADD (datepart, number, date)
>>
>> Also, as a FWIW you can add GETDATE() + 0.333, but that is not what you
>> are
>> after this time.
>>
>> RLF
>>
>> "Brian" wrote in message
>> news:F02EB8F6-A84A-495B-BE04-0929CD960619@microsoft.com...
>> > Hi there
>> >
>> > Hopefully this will be an easy one for someone. I am using SQL Server
>> > 2005.
>> > I am based in the UK and our users are in the UK. We have recently
>> > changed
>> > hosting providers and their server is located in the USA.
>> >
>> > Our database has a default value of getdate() when a record is added
>> > however
>> > as the server is set to the time in the USA, which I guess is for
>> > maintenance
>> > reasons as it is a managed server. I was thinking that I would be able
>> > to
>> > add
>> > or subtract the time difference on to this?
>> >
>> > Does anyone have any idea of the syntax. I know that if it was plus a
>> > day
>> > I
>> > would do something like getdate()+1 but how do you do it for part of a
>> > day?
>> >
>> > Any help much appreciated.
>> > Thanks
>> > Brian
>>
>>
>>
date: Thu, 26 Jun 2008 10:55:42 -0400
author: Russell Fields
|
|