We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to group a column with DateTime values without showing its time part in SfDataGrid?

Platform: Xamarin.Android |
Control: SfDataGrid |
Published Date: February 8, 2016 |
Last Revised Date: August 4, 2016

SfDataGrid control allows you to group a column with DateTime data, however it will display the entire DateTime value including the time part in its cells, like in the following screenshot.

If you do not want to display the time part of the DateTime object then apply Format to the corresponding column. Refer the below code example.


In the following screenshot note that DateTime data in the ShippingDate column contains only the date part.

You can see that the group caption summary row contains both the date and time values.If your requirement is to group by a date column and also to display only the date part in the caption, then you can achieve it by writing a converter to apply the custom grouping logic. Refer the below code example.



public class GroupDateTimeConverter:IValueConverter


   public object Convert (object value, Type targetType, object parameter,CultureInfo culture)


      OrderInfo order = value as OrderInfo;

      return order.ShippingDate.ToString("dd/MM/yyyy");


   public object ConvertBack (object value, Type targetType, object parameter,CultureInfo culture)


      return null;




The following screenshot shows the final outcome upon execution of the above code

Since we have returned a string value in the converter, the groups are sorted considering the GroupKey values as string. If you want to sort the groups considering it to be DateTime value then you need to write a SortComparer for it.

Refer the following code example to create a custom SortComparer




The following screenshot shows the final outcome without time and proper sort order

You can download the working sample for this KB from the below link

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment
Jul 20, 2016
very helpful Reply
Jul 20, 2016
Sort on group column does not work. Even in the download sample. Reply
Divakar Subramaniam [Syncfusion]
Aug 04, 2016
Hi Steve,

Please set AllowSorting property in SfDataGrid to "true" and it will work. Also we have refreshed the sample.

Oct 26, 2016
it s useful.but while compare tat tym i give my table name but it doesnt working . Reply
Divakar Subramaniam [Syncfusion]
Oct 26, 2016
Hi Jayapradha,

Thanks for the feedback. In your query, you have mentioned "my table name". We were not able to understand what it actually means. Also, please provide some more details about your query which will help us to proceed further.


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon