OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions How to change date format?

This topic contains 8 replies, has 4 voices, and was last updated by  Stepan Yudin 8 years, 3 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #36121

    Stepan Yudin
    Participant

    Hi everyone!

    Is there an easy solution to change Date and DateTime format?
    In fact, i have to change format without switching the locale in settings. And i didnt found anything that looks like settings for date/datetime formatter in LocaleBundle configuration class.


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #36122

    Rodolfo
    Participant
    #36123

    Artem Liubeznyi
    Spectator

    Hi Stepan,

    Do you want to make changes in the date/time formatting on the system/org level, or apply them to a specific fields only? Please tell us more about your use cases.

    Thank you.

    #36124

    umatkid
    Participant

    Oro guys help please!I have the same problem, I want change date/time format for all system. Can you help with it.

    #36125

    Artem Liubeznyi
    Spectator

    Sure. Same question for you though: Can you please specify, what format you are trying to change exactly? Normally, the date & time format of an organization depends on its configured locale; please refer to our user guide to learn how to change it.

    #36126

    Stepan Yudin
    Participant

    Yes, I found solution several month ago, afternoon i will post it here. In summary – i extended Formatter and use new class in formatter service


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

    #36127

    umatkid
    Participant

    Hi Oro guys.I need the format “d.m.Y H:i:s”.
    @Stepan, Can you share with me your solution please?

    #36128

    Stepan Yudin
    Participant

    Sorry for delay, i was really busy last quarter.
    My task was to define only one DateTime format for any locale choosed Oro in settings.
    This solution is little dirty but works)

    0. I created my own LocaleBundle

    1. I extended DateTimeFormatter (see parent class and bundle for explanation)

    2. I replaced DateTimeFormatter class in my bundle services.yml with my new OQDateTimeFormatter class:


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

    #36129

    Stepan Yudin
    Participant

    And dont forget to clear all caches and dump all JS (because there are dependencies with moment.js)


    Docker environment for Symfony2/OroCRM/OroBAP development on Windows platform
    https://github.com/stepansib/sf-oro-docker

Viewing 8 replies - 1 through 8 (of 8 total)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top