Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Adjusting to user's local time

 
   Database Forums (Home) -> Notification Services RSS
Next:  ODBC connection  
Author Message
Andy

External


Since: Jul 10, 2007
Posts: 6



(Msg. 1) Posted: Tue Jul 10, 2007 7:27 am
Post subject: Adjusting to user's local time
Archived from groups: microsoft>public>sqlserver>notificationsvcs (more info?)

Hi,

I have a notification I'm sending out, and I'm storing an expiration
date as UTC. I'd like to format this to the user's local time based
on the subscriptions timezone setting.

I can figure out how to do this, but I'd be tapping into NS' timezone
tables and I'd like to confirm that this is an appropriate way to
handle this task.

Thanks
Andy

 >> Stay informed about: Adjusting to user's local time 
Back to top
Login to vote
Todd C

External


Since: Nov 16, 2005
Posts: 110



(Msg. 2) Posted: Thu Jul 19, 2007 5:18 am
Post subject: RE: Adjusting to user's local time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello Andy:

Why not do this:

[Expiration in Local Time] = DateAdd(hour, DateDiff(hour, GETUTCDATE(),
GETDATE()), [Expiration in UTC Time])

One caution: This only applies to records where the [Expiration Date] is in
the same Daylight Savings timeframe as the current date. In other words, this
is accurate if you are looking at an [Expiration Date] coming up in a week.
But if you are looking at an [Expiration Date] that will be in, say, November
or December (after the U.S. has gone off Daylight Savings Time) then you will
be off by one hour.

The choice is yours: If that one hour difference is acceptable for 6 months
out of the year, then it will work. If not, you will need to figure out
something else.

Best of luck.

HTH

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Andy" wrote:

> Hi,
>
> I have a notification I'm sending out, and I'm storing an expiration
> date as UTC. I'd like to format this to the user's local time based
> on the subscriptions timezone setting.
>
> I can figure out how to do this, but I'd be tapping into NS' timezone
> tables and I'd like to confirm that this is an appropriate way to
> handle this task.
>
> Thanks
> Andy
>
>

 >> Stay informed about: Adjusting to user's local time 
Back to top
Login to vote
Andy

External


Since: Jul 10, 2007
Posts: 6



(Msg. 3) Posted: Mon Jul 23, 2007 7:45 am
Post subject: Re: Adjusting to user's local time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 19, 8:18 am, Todd C wrote:
> Why not do this:
>
> [Expiration in Local Time] = DateAdd(hour, DateDiff(hour, GETUTCDATE(),
> GETDATE()), [Expiration in UTC Time])
>
> One caution: This only applies to records where the [Expiration Date] is in
> the same Daylight Savings timeframe as the current date. In other words, this
> is accurate if you are looking at an [Expiration Date] coming up in a week.
> But if you are looking at an [Expiration Date] that will be in, say, November
> or December (after the U.S. has gone off Daylight Savings Time) then you will
> be off by one hour.
>
> The choice is yours: If that one hour difference is acceptable for 6 months
> out of the year, then it will work. If not, you will need to figure out
> something else.

Well the problem is that users may be in China, France, or Germany,
and this only accounts for users in the same timezone in which the
server is located.
 >> Stay informed about: Adjusting to user's local time 
Back to top
Login to vote
Todd C

External


Since: Nov 16, 2005
Posts: 110



(Msg. 4) Posted: Mon Jul 23, 2007 8:04 am
Post subject: Re: Adjusting to user's local time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andy:

Fair enough.

Can we assume that a user in one particular time zone will ALWAYS be in that
particular time zone? If so, you may need to capture the time difference as
part of the subscription. I believe Windows time zone tables include an
integer field that would indicate this.

Sorry that I cannot take you any further. I don't have experience or
knowledge of how to tap into the OS to get something like that.

If the user signs up for the subscription while in China, and expects the
notification to be formatted correctly for him while he just happens to be in
Athens, then you REALLY have your work cut out for you.

Things were SO much simpler when the world was FLAT

Smile

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Andy" wrote:

> On Jul 19, 8:18 am, Todd C wrote:
> > Why not do this:
> >
> > [Expiration in Local Time] = DateAdd(hour, DateDiff(hour, GETUTCDATE(),
> > GETDATE()), [Expiration in UTC Time])
> >
> > One caution: This only applies to records where the [Expiration Date] is in
> > the same Daylight Savings timeframe as the current date. In other words, this
> > is accurate if you are looking at an [Expiration Date] coming up in a week.
> > But if you are looking at an [Expiration Date] that will be in, say, November
> > or December (after the U.S. has gone off Daylight Savings Time) then you will
> > be off by one hour.
> >
> > The choice is yours: If that one hour difference is acceptable for 6 months
> > out of the year, then it will work. If not, you will need to figure out
> > something else.
>
> Well the problem is that users may be in China, France, or Germany,
> and this only accounts for users in the same timezone in which the
> server is located.
>
>
 >> Stay informed about: Adjusting to user's local time 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
time event? - Hi, I have some data in my database which stores when a contract expires. I'd like to send a notification 90, 60 and 30 days before the contract will expire. I'm having trouble coming up with a good event to trigger notifications. Do I setup the event...

User Notifications - As a newbie, I need help with an issue. Is it possible to set up a notification to myself that alerts myself whenever a specific user(s) logs onto a sql database? I hope someone can help! Many thanks, Dominic

What's the lag time btwn EventsQuery & PostQuery? - In the DB where I'm storing my data, I have flags on which records need to be processed through Notification Services, to make it easy for my EventsQuery to go grab them. These flags are set up the chain by the application. After processing, using the....

daylight savings time change? - Hi, I'm trying to determine if we need to apply the "2007 time zone update for SQL Server 2005 Notification Services". i have determined by looking at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NS\Setup\Version that we ...

Finding out user tables in database - Hi, I need to find out all the user tables in a database. For this purpose I have written following query. NSBank is the name of the database. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USE NSBank; select name, type_desc from sys.objects where type='u'...
   Database Forums (Home) -> Notification Services All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]