Primitive Data
Types
The primitive
data types in X++ are listed in the following table. For more information about
each data type, click its link.
A placeholder for any data type. |
|
The boolean data type contains
a value that evaluates to either true or false. You can use the X++ reserved
literals true and false
where ever a Boolean expression is expected. |
|
Contains day, month, and year. The date data type can hold dates in the closed interval
[1\1\1900; 31\12\2154], that is: between January 1, 1900, and December 31,
2154. |
|
An abbreviation for enumerated
text—a set of literals. Enum values are represented internally as integers.
The first literal has number 0, the next has number 1, the next has number 2,
and so on. You can use enums as integers in expressions. |
|
|
|
A number without a decimal point.
To declare an integer, use the keyword int. Integers are
numbers without decimals. X++ has two integer types:
|
|
Numbers with a decimal point; also
called decimals. |
|
A number of characters. To declare
a string, use the keyword str. Strings are sequences of characters that are used as
texts, help lines, addresses, telephone numbers, and so on. To declare a
string in X++, use the str keyword. A string can hold an indefinite number of characters.
If you know the absolute maximum of characters a string will hold, you can
specify this in the variable declaration and force a truncation to the
maximum length of the string. |
|
Contains hours, minutes, and
seconds. To declare a time, use the system type timeOfDay. |
|
Contains year, month, day, hour,
minute and second. |
The utcdatetime data type is intrinsic to X++. It combines
date and timeOfDay types into one type. A utcdatetime variable also holds time
zone information, though this information is not accessible to X++ code.
Range
and Precision
The following table describes the range and precision of
the utcdatetime data type.
Attribute of utcdatetime |
Description |
Precision
|
The
smallest unit of time in utcdatetime is one second. |
Default
and Null |
1900-01-01T00:00:00 A utcdatetime variable that has been declared but not
initialized has the default value of 1900-01-01T00:00:00.
This is the value returned by DateTimeUtil ::minValue().
Some
functions treat an input parameter of this minimum value as null. For
instance, the DateTimeUtil ::toStr method returns an
empty string, however, the DateTimeUtil ::addSeconds
method returns a fully usable utcdatetime value. |
Minimum
Value |
1900-01-01T00:00:00 |
Maximum
Value |
2154-12-31T23:59:59 This
matches the upper range of date and timeOfDay.
|
No comments:
Post a Comment