Announcement

Collapse
No announcement yet.

How to show year and month only in Date Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to show year and month only in Date Field

    Hi,

    I want to show month and year in Date field. can anyone tell me how to do this ??
    Cheers!
    Nishan.

  • #2
    someone can advice me on this ?
    Cheers!
    Nishan.

    Comment


    • #3
      I dont think it is posible due to the field type... The Date fields in espo are date fields in the mySQL database.

      If you really need to show only month and year you could use a secondary field that updates when the date field is updated usin a workflow and format it as you want with a formula and a function like:

      Code:
      secondaryCustomDateField = datetime\format(yourOriginalDateField, 'America/New_York', 'MM YYYY')


      Comment


      • #4
        oscarbm92 thank you for the reply. I have tried this with formula and its working prefect. I did small adjustment to get month in word.

        Code:
        datetime\format(yourOriginalDateField, 'America/New_York', 'MMMM YYYY')
        This shows month as "May 2020"


        Cheers!
        Nishan.

        Comment


        • #5
          For this reason I'm just using a varchar field instead of date field.
          The date field is also too wonky too. It can't be smart and does guess work. For example if you type.
          01/05/19 it will think it 1st of May 20, rather than 1st of May 2019
          It can't also read wording too, for example, pasting 1 May 2019 will not work.

          A good and a bad thing I suppose. Lastly it due to the weakness of full date must be selected. I have many date that we are only know about just the Year, sometime we get Year and Month. But certain details field we dont have any date at all.

          Varchar field will have sorting issue and PDF/Email template merging issue though. Best to just use the date field if you need to rely on these.

          Comment


          • #6
            You can create a custom field to do this. I create one to display the date MM-yyyy in field. Like this:


            Click image for larger version

Name:	image.png
Views:	107
Size:	25.5 KB
ID:	108820

            For this I used bootstrap datepicker format: https://bootstrap-datepicker.readthe...html#format​


            You can see custom field here https://github.com/porquero/EspoCRM-customDate
            Last edited by criffoh; 07-25-2024, 07:15 PM.

            Comment


            • esforim
              esforim commented
              Editing a comment
              Thank you for reviving this thread with that Custom Field extension! Hope to see more of your work.
          Working...
          X