Thanks Andrew. It isn't SQL Server, but I still enjoyed hearing how it would be done.
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, June 05, 2014 12:12 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: now() with time zone adjustment
Liz, I was going to suggest the API method but luckily Graham beat me to it and did it better :-)
However, if you are using SQL Server for the log table, let the server put the date/time in. That way nobody can put any "wrong" date/times in. With Logging tables I always use a default of GETDATE() for the field(s) and never set the field values in code/form. The record on in the database is then automagicaly the date/time when it happened on the server and anyone viewing the data willl see it in their local time. (OK, that last part has a few caveats but it usually does the right thing.)
In really difficult cases, where there are "legacy" applications adding the date/times via code or per hand, I will use an insert trigger on the table to "correct" any values which differ more than a few seconds from the server date/time.
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 (17) |
Tidak ada komentar:
Posting Komentar