Date Format in Filter section

Stimulsoft Reports.NET discussion
Post Reply
aussiegirl
Posts: 15
Joined: Thu Apr 08, 2010 12:29 am

Date Format in Filter section

Post by aussiegirl »

Hello

I am using the filters from a WinForm application and the date format I use is dd/MM/yyyy on the Form which is correct, but on the DataBand filter the dates are entered in as MM/dd/yyyy which doesn't filter the correct results

Thank You
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Date Format in Filter section

Post by Andrew »

Hello,

In the databand filter, when you specify a filter by date, dates are output using the date time picker.
Its result does not depend on the string format of a date.
Or maybe you use date as a string?

Thank you.
aussiegirl
Posts: 15
Joined: Thu Apr 08, 2010 12:29 am

Date Format in Filter section

Post by aussiegirl »

Hi Andrew

This is what I was using

Code: Select all

Datasales.Filters.Add(New StiFilter("InvoiceDate", StiFilterCondition.Between, Format(dtpDateFrom.Text, "dd/MM/yyyy"), Format(dtpDateTo.Text, "dd/MM/yyyy"), StiFilterDataType.DateTime))

Thank You
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Date Format in Filter section

Post by Jan »

Hello,

Please use following code:

Code: Select all

StiDataBand dataBand = report.GetComponentByName("DataBand1") as StiDataBand;
            if (dataBand != null)
            {
                dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, DateTime.Now, DateTime.Now));
                report.Design();
            }
Thank you.
aussiegirl
Posts: 15
Joined: Thu Apr 08, 2010 12:29 am

Date Format in Filter section

Post by aussiegirl »

Hi Jan

I don't understand why I would use the DateTime.Now? The dates are coming from a Form within the Report, so there is a DateFrom and DateTo. So the date range is going to be selected by the users.

Thank you.

Jan wrote:Hello,

Please use following code:

Code: Select all

StiDataBand dataBand = report.GetComponentByName("DataBand1") as StiDataBand;
            if (dataBand != null)
            {
                dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, DateTime.Now, DateTime.Now));
                report.Design();
            }
Thank you.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Date Format in Filter section

Post by Jan »

Hello,

I have provided this code only as sample. You can use your variables instead DateTime.Now. For example:

Code: Select all

dataBand.Filters.Add(new StiFilter("InvoiceDate", StiFilterCondition.Between, date1, date2));
Thank you.
Post Reply