Kamis, 05 Juni 2014

RE: [MS_AccessPros] Re: now() with time zone adjustment

 

Weird.  I've seen all 3 posts.  Thanks Andrew.

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, June 05, 2014 1:30 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: now() with time zone adjustment

 



I just realised, again, why I don't post here very often... the yahoo software doesn't like me and keeps silently discarding my posts. Third time lucky...

 

LIz, I was going to suggest an API/UTC solution similar to Graham's but he got their first and did it better than I had.

 

However, if I remember correctly, you are using a SQL Server backend and, faced with filling a log table (or just a createdate field) I always use a default value on the field of GETDATE() and don't use any code in th front-end to put any values in the field. That way the field always puts the server's date/time in the field and anyone looking at the data sees all records with the date/time expressed in their local timezone.

 

In complicated cases, like when old code might be setting incorrect values into the field, I use insert triggers to fix the date/time if they are out by more than a couple of seconds.

 

You can add a default to an existing table/field:

 

ALTER TABLE [TableName] ADD CONSTRAINT [DF_TableName_FieldName] DEFAULT GETDATE() FOR FieldName

 

With the TableName and Fieldname texts replaced by the appropriate values.

 

Yours,

Andrew

 






This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

__._,_.___

Posted by: Liz Ravenwood <Liz_Ravenwood@beaerospace.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (19)

.

__,_._,___

Tidak ada komentar:

Posting Komentar