Using a Button to Record the Current Server Time and Date
Use a button to record the server time and date in a record.
Introduction
By using MetaScript in a button's click action script, the current server time and date can be recorded whenever the button is pressed.
By recording the time and date of the server, you can eliminate any disparity between individual client computer clocks and that introduced by client computers in different time zones.
Note that this snippet is part of a series that explores different ways of recording time and date. See - Time and Date Series Snippet Index for other related methods.
Description
The following MetaScript should be used for a button's click action script to record the current server time and date.
var btnpresstime = ServerTime(); var btnressdate = ServerDate(); SetField("TS_917_CurrentTime", btnpresstime); SetField("TS_917_CurrentDate", btnpressdate); //"TS_917_CurrentTime" and "TS_917_CurrentDate" above should be changed to the names of the fields you will use to store the recorded time and date.
Resources
- Download and install a sample form illustrating this Toolbox Snippet (see below)
- Toolbox Snippet - Time and Date Series Index Snippet Index