Format any date to match the user's locale settings with this Client Script

Format any date to match the user's locale settings with this Client Script

A common problem in Zoho Client Script is a user's date format. On Create/Edit pages, Zoho will only accept a date if it matches the user's locale. Even if the date is in a correct format, or Zoho date format, user's can't save a record if the date format entered doesn't match the user's settings.

There's a few ways around this:

  1. Make all users use the same date format
  2. Update dates after a record is saved with deluge
  3. Manually require users to use the date picker
  4. Use my method below
Attached is a script for you to download. You will need the change the file extension to .js before proceeding.

Go to Client Script --> Static Resources



Click 'New Resource' and follow the prompts to upload the file I've given you.



Now in your client script, click on Static Resources and click 'Add' next to the resource you just added






Now to format your date, simply call the function within the static resource like this:

  1. log(formatDate(new Date,$Crm.user.date_format))

The function needs two parameters. The date, and the date format. In this instance, I'm getting the date format from the user details so it will dynamically format the date to whatever format the user has set with 1 line of code within your Client Script.

      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ





                                ご検討中の方