Kamis, 05 Juni 2014

[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

__._,_.___

Posted by: yahoo@craven.de
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (13)

.

__,_._,___

Tidak ada komentar:

Posting Komentar