OP Get server date

4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next

version 1.5


OP Get server date (connectionID; serverDate) Longint

ParameterTypeDescription
connectionIDLongintConnection ID with target server
serverDateDateCurrent system date on server
Function resultLongintError 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 CodeDescription
10128The 4D Open for 4th Dimension package has not been initialized.
10136The connection does not exist.
10154This 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.


4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next