This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
Current time
|
Current time {( * )} -> Function result | ||||||||
Parameter | Type | Description | ||||||
* | Operator |
![]() |
Returns the current time from the server | |||||
Function result | Time |
![]() |
Current time | |||||
The Current time command returns the current time from the system clock.
The current time is always between 00:00:00 and 23:59:59. Use String or Time string to obtain the string form of the time expression returned by Current time.
4D Server: If you use the asterisk (*) parameter when executing this function on a 4D Client machine, it returns the current time from the server.
The following example shows you how to time the length of an operation. Here, LongOperation is a method that needs to be timed:
$vhStartTime:=((Current date-!1980-01-01!)*86400)+Current time //Save the start time, seconds after 1.1.1980
LongOperation //Perform the operation
$vhEndTime:=((Current date-!1980-01-01!)*86400)+Current time
ALERT("The operation took "+String($vhEndTime-$vhStartTime)+" seconds.") //Display how long it took
The following example extracts the hours, minutes, and seconds from the current time:
$vhNow:=Current time
ALERT("Current hour is: "+String($vhNow\3600))
ALERT("Current minute is: "+String(($vhNow\60)%60))
ALERT("Current second is: "+String($vhNow%60))
Product: 4D
Theme: Date and Time
Number:
178
Created: < 4D v6
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)