Friday 15 May 2015

sorting - Filtering and comparing a date stored as a string in Delphi -


Working with legacy projects that have the format stored in the form of a string

  '6/1/2013'   

I'm trying to do the example of the date range filter:

  table.filter: = 'stringdate> ; = '+ Quoted SRT (adapter.txt) +' and '+' stringdata & lt; = '+ Coated STR (Endadvert. Text);   

Obviously this does not work. When setting the date range filter, the data is incorrect because we are adjusting a date.

What are some ways that I type it date data correctly?

You do not indicate what the built-in DBMS is, therefore you can potentially do this in SQL a filter Instead of

If you can not do this and the dataset is not very large, then you can convert the database date value to actual dates and use them in the OnFilterRecord event Are:

  Process TForm3.Table1FilterRecord (Dataset: accept TDataSet; var: boolean); Var Tablet: TDTime; Getting Started Table: = Strontodet (Table1DateField.AsString); Accept: = (TableDate> = AdatePicker.Date) and (TableDate & lt; = EndDatePicker.Date); End;    

No comments:

Post a Comment