NOTE: use DEBUG to see what value is in fVAlue and DValue
---------- Maybe:
var fValueDateTime:TDateTime; begin fValueDateTime:= cxCustomGridRecord.Values(i); // no error if TDateTime // // if Values(i) = String // fValueDateTime:= StrToDateTime( cxCustomGridRecord.Values(i) ); //
Type: DateTime A System.DateTime structure which represents the minimum allowed date.
Use the MinDate and MaxDate properties to limit user input to dates falling within a specific range. The MinDate property specifies the low limit of the allowed date range.
Dates which are out of the specified range cannot be entered into the date editor by end-users either by typing within the editor's edit box or using the dropdown calendar. In the dropdown calendar, these dates are displayed using a specific style (CalendarProperties.DayOutOfRangeStyle) and don't respond to user clicks. When an end-user types an unavailable date in the editor's edit box, a warning message is displayed if the ShowOutOfRangeWarning property is set to true. After the editor loses focus, the date automatically changes to the last specified allowed date.
Note that programmatic manipulation on the date editor's value isn't limited by the MinDate and MaxDate property values.
---------- You can use the following approach to set the MinDate property of TcxBarEditItem with DateEdit: [Delphi]Open in popup window (TcxBarEditItem.Properties as TcxDateEditProperties).MinDate := <ADate>;
---------- DevExpress 18.2.1 VCL Delphi 10.3.1
cxDateNavigator1.Date := EncodeDate(1,12,31); // YYYY-MM-DD = OK
----------
DevExpress type DateTime is equal Delphi System.DateTime type
----------
Example using cxDateNavigator:
// Year = 1, Month = 12, Day = 31 cxDateNavigator1.Date := EncodeDate(1,12,31); ===> OK is accept an not error is generated.
BUT... the buttons < and > from cxDateNavigator stay frozed (dont work) BUT if you use the keyboard arrows to change date < 31/12/100
---------- the control changes the date without any problem. Then confirm that using the schedule you can change the date to values smaller than the year 100. But using the buttons of the control this does not work, because the limit year is 100. But using the arrows on the keyboard, this limit does not exist and you can get to year 1. Since Delphi sets the maximum date for 12/31/9999, then you can programmatically enter the minimum date for 01/01/01
In case of using Dataware components, table fields in database, you must observe which values are accepted in this case according to the database. but it will probably be the default limits used by the current programming languages.
---------- RAD Studio Delphi 10.3.1 unit System.DateUtils;
function IsValidDate(const AYear, AMonth, ADay: Word): Boolean; begin Result := (AYear >= 1) and (AYear <= 9999) and (AMonth >= 1) and (AMonth <= 12) and (ADay >= 1) and (ADay <= DaysInAMonth(AYear, AMonth)); end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
DateEdit - How to change the MinDate property when changing a value in another DateEdit control
https://www.devexpress.com/Support/Center/Question/Details/T507738/dateedit-how-to-change-the-mindate-property-when-changing-a-value-in-another-dateedit
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
https://www.devexpress.com/Support/Center/Question/Details/Q333797/i-don-t-want-that-cxdatetime-raise-error-with-message-value-out-of-bounds
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
maybe, work with "date" in string format is not very good! Because, you'll need always converting to TDate / TDateTime etc... to work in your system (calculate or tables in your database).
And, with one "wrong string" YOU will have one date wrong!
For this, the TDateTime use a type DOUBLE (numeric) to works/store the dates and times = (left = days, right = time)
So, avoid any error math because, number is number, always!
you see?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
"The Variant type is used for variables that can change type at run time. Variants offer greater flexibility, but consume more memory than regular variables, and operations on them are slower than on statically bound types. Moreover, illicit operations on variants often result in run-time errors, where similar mistakes with regular variables would have been caught at compile time. You can also create custom variant types.
By default, Variant variables can hold values of any type except records, sets, static arrays, files, classes, class references, and pointers. In other words, variants can hold anything but structured types and pointers. They can hold interfaces, whose methods and properties can be accessed through them. They can hold dynamic arrays, and they can hold a special kind of static array called a variant array. Variants can mix with other variants and with Integer, Real, string, and Boolean values in expressions and assignments; the compiler automatically performs type conversions.
Variants that contain strings cannot be indexed.
You can define custom variants that extend the Variant type to hold arbitrary values. For example, you can define a Variant string type that allows indexing or that holds a particular class reference, record type, or static array. Custom Variant types are defined by creating descendants to the TCustomVariantType class.
On 32-bit platforms, a Variant occupies 16 bytes of memory. On 64-bit platforms, a Variant is a 24-byte record. A variant record consists of a type code and a value, or a pointer to a value, of the type specified by the type code. See Internal Representation of Variant Types. All variants are initialized on creation to the special value Unassigned. The special value Null indicates unknown or missing data."
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
"Out-of-range assignments often result in the target variable getting the highest value in its range. Invalid variant operations, assignments or casts raise an Variants.EVariantError exception or an exception class descending from Variants.EVariantError.
Special conversion rules apply to the System.TDateTime type declared in the System unit. When a System.TDateTime is converted to any other type, it treated as a normal Double. When an integer, real, or Boolean is converted to a System.TDateTime, it is first converted to a Double, then read as a date-time value. When a string is converted to a System.TDateTime, it is interpreted as a date-time value using the regional settings. When an Unassigned value is converted to System.TDateTime, it is treated like the real or integer value 0. Converting a Null value to System.TDateTime raises an exception.
On the Win32 platform, if a variant references a COM interface, any attempt to convert it reads the object's default property and converts that value to the requested type. If the object has no default property, an exception is raised."
...
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
then, you need know "if" the "vv" (variant) is not one value invalid. Then if yes, the conversion occurr but the value TDateTime will be the default value, for example. for that the error dont occur on the use, but the exception is catch by system when your app end,
try use TRY/EXCEPT/END block for test
try .... except on e:exception {generic} do showmessage( e.message ); end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3