Returns the object to request time details from the Singular server.
ServerDate() is required for synchronizing clocks and timers between in the app instance, and the overlay.
The ServerDate object has following methods:
|Method||Return type||Brief description|
|getOffset()||number||Returns the time offset between the Singular Server and the local device in [ms]|
|now()||number||Returns the Singular server time as UTC timestamp|
Makes a request to fetch the time offset between the Singular server and the local device in [ms].
1 2 3
// The code below prints the time offset to the console var timeOffset = singularApp.ServerDate().getOffset(); console.log("timeOffset =", timeOffset);
number - time offset as number
timeOffset = 829.5
Makes a request to get the Singular server time as UTC timestamp.
1 2 3
// The code below prints the Singular server time to the console var timeNow = singularApp.ServerDate().now(); console.log("timeNow =", timeNow);
number - server time as number
timeNow = 1588976118246.5