DateTime format

6 posts, 1 answers
  1. Gianpaolo
    Gianpaolo avatar
    14 posts
    Member since:
    Nov 2013

    Posted 22 Jan 2016 Link to this post

    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?

  2. Answer
    Polya
    Admin
    Polya avatar
    267 posts

    Posted 26 Jan 2016 Link to this post

    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
  3. LCCICT
    LCCICT avatar
    3 posts
    Member since:
    Aug 2016

    Posted 17 Nov 2017 in reply to Polya Link to this post

    Hi Polya,

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

    Cheers

    Phil.

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    548 posts

    Posted 21 Nov 2017 Link to this post

    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.
  5. LCCICT
    LCCICT avatar
    3 posts
    Member since:
    Aug 2016

    Posted 30 Nov 2017 in reply to Vladimir Stoyanov Link to this post

    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.

  6. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    548 posts

    Posted 05 Dec 2017 Link to this post

    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.
Back to Top