version 1.5
OP Get server date (connectionID; serverDate) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
serverDate | Date | Current system date on server | |
Function result | Longint | Error code result for the function |
Description
OP Get server date returns in serverDate the system's date on the server indicated by connectionID.
Error Codes
If OP Get server date executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10136 | The connection does not exist. |
10154 | This command cannot be executed right now. |
Example
This example uses the server's system date and time to timestamp order entry. The 'getTimeStamp' method ensures that even if some of the worstations have a wrong time or date, they will get the proper settings from the server.
` GetTimeStamp (connectionID) -> Timestamp ` ConnectionID number -> connection ID with targer server ` Timestamp String -> YYYYMMDDHHMMSS C_LONGINT ($1;$connID) C_STRING (14;$ts;$0) C_LONGINT ($errCode) C_DATE ($serverDate) C_TIME ($serverTime) $ConnId := $1 $errCode := OP Get server date ($connID;$serverDate) $errCode := OP Get server time ($connID;$serverTime) $ts := String ( Year of ($serverDate); "####") $ts := $ts + String ( Month of ($serverDate); "##") $ts := $ts + String ( Day of ($serverDate); "##") $ts := $ts + Substring ( Time string ($serverTime); 1 ; 2 ) $ts := $ts + Substring ( Time string ($serverTime); 4 ; 2 ) $ts := $ts + Substring ( Time string ($serverTime); 7 ; 2 ) $0 := $ts
See Also
Current date, Current time, OP Get server time.