Date
This keyword declares a date variable where the value is within the range from [1/1/1600] to [31/12/9999], plus a null date [0/0/0].
Local Date NAME
Local Date NAME(DIMENSIONS)
Variable Date NAME(DIMENSIONS)
Value Date NAME(DIMENSIONS)
Const Date NAME(DIMENSIONS)
NAME
is the name of the declared variable.DIMENSIONS
can be:
Several variable declarations can be done on the same line, separated by a comma.
Local declarations create the variables in the current local variable class that is not seen by nested or calling subprograms. The Call / Subprog and func / Funprog insulate the local variables as well as the calls of method by fmet.
Const, Variable, and Value declarations state the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted wherever the parentheses are present. The dimension and index ranges are defined by the calling program.
# Direct declarations
Local Date TODAY, TOMORROW, YESTERDAY : # Local date variables
Local Date PERIOD_LIMITS(1..60) : # An array of 60 dates values
# A sub-program sending dates and returning a result
Funprog SEND_DATES(MYDATES)
Variable Date MYDATES(,) : # A 2 dimensions matrix of dates is sent as reference
...
End SEND_STATUS
# A sub-program storing dates
Subprog STORE_VALUES(APPOINTMENT_DATES)
Value Date APPOINTMENT_DATES(1..5) : # An array of 5 elements is sent (a copy is done when passing the arguments)
...
End
Local Date TEST_DATE
Local Char TEST_CHAR
TEST_DATE = [31/01/2014] # TEST_DATE = 20140131 (Date format)
TEST_CHAR = TEST_DATE # TEST_CHAR = "20140131" (String format - implicit data type conversion)
TEST_DATE > date$ # Is 20140131 > date$ ? Either true or false depending on date
# All other comparison operators work
TEST_DATE += 50 # Add 50 days to TEST_DATE (Note upper limit=[31/12/9999])
TEST_DATE -= 75 # Subtract 75 days from TEST_DATE (Note lower limit=[01/01/1600])
TEST_DATE = "140131" # Convert string to date using adxdcs year
TEST_CHAR = num$(TEST_DATE) # TEST_CHAR = "[31/01/2014]"
The date data type will implicitly convert two string formats to a valid date. The two string formats are "YYYYMMDD" and "YYMMDD". In the format "YYMMDD" that the pivot year variable adxdcs is used to determine the century.
<pre><code>
Local Date MY_DATE # Declare date
MY_DATE = "20170630" # String YYYYMMDD date
MY_DATE = "170630" # String YYMMDD date
</pre></code>
Global, Local, Variable, Value, Const, Tinyint, Shortint, Integer, Float, Double, Decimal, Char, Clbfile, Blbfile, Uuident, Datetime, Instance.