TheTom
TheTom

Reputation: 1054

Kendo UI Grid Filter asp.net change date format

How can I change the Dateformat in kendo grid filter forDate?

actually, I have a FilterableOperatorsBuilder ForDate, But I do not know how to solve the problem. I always get 01/04/2016 as date in the filtering datepicker, but I need to have 2016-04-01.

Here is what I've got until now:

 public static Action<GridFilterableSettingsBuilder> FilterSettings()
    {
        Action<GridFilterableSettingsBuilder> configurator = ftb =>
        {
            ftb.Mode(GridFilterMode.Menu);
            ftb.Extra(false).Operators(o => o.ForString(str => str
                    .Clear()
                    .Contains("Contains")
                    .IsEqualTo("Is equal to")
                    .IsNotEqualTo("Is not equal to")
                    .StartsWith("Starts with")
                    .EndsWith("Ends with")));

            ftb.Extra(false).Operators(o => o.ForDate(
          --->> I think ii need to change the date format right here?
         ));
        };

        return configurator;
    }

It would be great if anyone can give me a hint.

Upvotes: 0

Views: 155

Answers (1)

TheTom
TheTom

Reputation: 1054

Ok, finally, there is a very simple solution:

I just added

 .Format("{0:yyyy-MM-dd hh:mm:ss tt}").Filterable(f => f.UI("DateTimeFilter"))

And this works fine , even if it might be not the perfect solution. If anyone have a better one, please let me know .

Upvotes: 1

Related Questions