This is a migrated thread and some comments may be shown as answers.

DateTime format

5 Answers 382 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Gianpaolo
Top achievements
Rank 1
Gianpaolo asked on 22 Jan 2016, 11:09 AM

Hello,

When grouping by a DateTime property without selecting a step, the value is formatted as 'mm/dd/yyyy HH:mm:ss'. Is it possible to change the format to not show the Time part of the DateTime object?

5 Answers, 1 is accepted

Sort by
0
Accepted
Polya
Telerik team
answered on 26 Jan 2016, 08:29 AM
Hello Gianpaolo,

You would need to implement a custom DateTimeGroupDescription as demonstrated in the following example from our online XAML SDK Repository:
https://github.com/telerik/xaml-sdk/tree/master/PivotGrid/CustomDateTimeGroupDescription

Overriding the ToString() method of the custom Group will allow to achieve the needed format. You can also take a look at this forum thread and this help article.

Hope this helps.

Regards,
Polya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
LCCICT
Top achievements
Rank 1
answered on 17 Nov 2017, 06:20 AM

Hi Polya,

Can the above example be used to create a group description for each of the Datetime steps?

Cheers

Phil.

0
Vladimir Stoyanov
Telerik team
answered on 21 Nov 2017, 04:43 PM
Hello,

If you have a custom DateTimeGroupDescription, as is the case in the example referenced in the previous reply, you can implement a group description for each step like the MonthYearGroup implemented in the example. That said, I don't know any details about your project. If you need further assistance, may I kindly ask you to provide some more details about your project and what you are trying to achieve. If you want to provide a sample project, you can open a support ticket.

I am looking forward to hearing from you.
 
Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
LCCICT
Top achievements
Rank 1
answered on 01 Dec 2017, 03:20 AM

Hi Vladimir,

The attached png is using the LocalDataSourcePersistence_WPF project in xaml-sdk-master.

What I want to be able to do is two things:

1) Format the date (currently displayed in the pivot grid) to dd-MMM-yyyy (without losing the current Datetime steps i.e. date-year,date-quarter, etc)

2) Add an additional Datetime step (i.e. option below date like date-year, date-quarter, date-month etc) that is MMM-yyyy (this is like the example that is CustomDateTimeGroupDescription in xaml-sdk-master, however I want to be able to extend the Datetime steps)

Is this possible?

Cheers

 

Phil.

0
Vladimir Stoyanov
Telerik team
answered on 05 Dec 2017, 04:28 PM
Hi Lutheran,

Thank you for the additional information. 

In order change the format of the date, you will need a custom DateTimeGroupDescription as in the CustomDateTimeGroupDescription example. I have modified the example in order to keep the default DateTime steps and I am attaching it for your reference.

As for adding additional Datetime nodes in the Date folder, you can override the GetFieldDescriptionHierarchy method of the custom LocalDataSourceFieldDescriptionsProvider and add a new FieldInfoNode. 

I hope you find this helpful. Don't hesitate to contact us again if you have any other questions.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PivotGrid
Asked by
Gianpaolo
Top achievements
Rank 1
Answers by
Polya
Telerik team
LCCICT
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or