| Date tip published: | 04/07/2003 |
| Description: | In Release 6 the @Now formula has been enhanced to allow the programmer to specify that the time/date should come from the server and to even specify the name of the server to get it from. |
To learn more about the new features in Notes Domino 6 use the following link:
Notes Domino 6 Application Development Update
Enhancements to @Now
Many Notes programmers use @Now to get the current time. @Now will get the time from the clock of the machine it is running on. Even if the database is on a server the time still comes from the user's computer that is executing the formula except when the formula is in a server based background agent. The time on the user's computer may be inaccurate since the user controls the time and date on their computer. Release 6 provides a solution to get the time and date from a Domino server. By using a flag, [SERVERTIME], you can specify that @Now is to get the time and date from a Domino server.
Using @Now with the new flags and parameters
The syntax of @now with the flags is:
@Now( flags ; serverNames )
The optional flags are:
- [SERVERTIME] gets the time-date from the server containing the database if serverNames is not specified or from the server listed in serverNames if serverNames is specified.
- [LOCALTIMEONERROR] gets the time-date from the local computer if an error occurs getting it from a specified server.
The seond parameter, serverNames is a Text or text list containing a server name or a list of server names. This parameter applies when [SERVERTIME] is specified and is optional.
Below are some scenarios for the use of @now with these parameters.
| Scenario | Formula | Result |
| Database is on the server | @Now([ServerTime]) | Returns the time/date from the server that the database resides on. If the database is local than the time/date will come from the local computer since no servername was specified. |
| Get the time from a specific server | temp:=@Now([ServerTime];"Server1/TLCC");
@If(@IsError(temp);
"Error";
@Text(temp)) | Returns the time/date from the server specified and returns an error if that server is not available. The example used @iserror to test for the error condition. |
| Gets the time from a specific server and if not available uses the local computer's time | @Now([ServerTime]:[LocalTimeOnError];"Server1/TLCC"); | Returns the time/date from the server specified, and, if not available, uses the local computer's time |
|