{"id":9881,"date":"2015-03-24T11:10:40","date_gmt":"2015-03-24T11:10:40","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagecrm\/?p=9881"},"modified":"2015-03-24T11:10:40","modified_gmt":"2015-03-24T11:10:40","slug":"displaying-date-fields-in-nonstandard-formats","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/","title":{"rendered":"Displaying date fields in Nonstandard formats"},"content":{"rendered":"<p style=\"text-align: justify;\">Support of JQuery has taken up the Sage CRM customization to the higher level as JQuery has wide range of built in functions as well as its syntax to manipulate DOM elements reduces lines of code which is something every developer will like.<\/p>\n<p style=\"text-align: justify;\"><em><strong><span style=\"color: #993300;\">New Stuff:<\/span><\/strong><\/em>\u00a0<a title=\"Adding Documents Tab to Leads in Sage CRM 2014 R2\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/23\/adding-documents-tab-to-leads-in-sage-crm-2014-r2\/\" target=\"_blank\">Adding Documents Tab to Leads in Sage CRM 2014 R2<\/a><\/p>\n<p style=\"text-align: justify;\">Working with dates on client side scripts is always been quite difficult. Sage CRM has different date formats which user can set for his own instance in User Preferences. Once user selects date format, all the date fields in CRM shows date in selected date format. Now, one of our customer walked in with the requirement that he needed date format like \u201c24 March 2015 (DD Month YYYY)\u201d. How this can be done?<\/p>\n<p style=\"text-align: justify;\">With little tweaking with JQuery it was possible to display dates in said format. Here is how this can be done. We can get current user&#8217;s date format using CurrentUser object of client side API. Below is the syntax for the same.<\/p>\n<p><em>&lt;snippet&gt;<\/em><br \/>\n<em> \/\/&#8217;Get user date format<\/em><br \/>\n<em> var CRM_USER_DATEFORMAT=&#8221;&#8221;;<\/em><br \/>\n<em> CRM_USER_DATEFORMAT=new String (CurrentUser.userpref_dateformat);<\/em><br \/>\n<em> &lt;\/snippet&gt;<\/em><\/p>\n<p style=\"text-align: justify;\">With this we will be able to identity dateformat of the date being displayed on the screen. Now, you need to write a function which will take date as input and return date in <strong>mm\/dd\/yyyy<\/strong> format.\u00a0 Below link would be useful for date conversion.<\/p>\n<p class=\"post-name\" style=\"font-weight: bold;\"><a title=\"Useful Date Functions\" href=\"https:\/\/community.sagecrm.com\/partner_community\/b\/hints_tips_and_tricks\/archive\/2009\/07\/10\/useful-date-functions.aspx\" target=\"_blank\" rel=\"noopener\">Useful Date Functions<\/a><\/p>\n<p style=\"text-align: justify;\">Once you have date converted in mm\/dd\/yyyy format, JQuery formatdate function can be used to get date in required format. Below is syntax for the same.<\/p>\n<p style=\"text-align: justify;\"><em>&lt;snippet&gt;<\/em><br \/>\n<em> var formatted_date = $.datepicker.formatDate(&#8216;dd M yy&#8217;, new Date(&lt;date in mm\/dd\/yyyy format&gt;));<\/em><br \/>\n<em> &lt;\/snippet&gt;<\/em><\/p>\n<p style=\"text-align: justify;\">Above function will return date in <strong>24 March 2015<\/strong> format if <strong>03\/24\/2015<\/strong> is passed as a parameter. This way we can format dates in required format. \u00a0In Sage CRM, this function is to be called on the screen in view mode so that date will be displayed in new date format on summary pages. While on edit screen date will be displayed in user date format. Hope you will use this.<\/p>\n<p style=\"text-align: justify;\">Happy scripting!!!<\/p>\n<p style=\"text-align: justify;\"><strong><em><span style=\"color: #993300;\">Also Read &#8211;\u00a0<\/span><\/em><\/strong><\/p>\n<p style=\"text-align: justify;\">1. <a title=\"Set Default Value for Date Field through Script\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2014\/10\/22\/set-default-value-for-date-field-through-script\/\" target=\"_blank\">Set Default Value for Date Field through Script<\/a><br \/>\n2. <a title=\"Default quote expiration\/Delivery date setting in Sage CRM\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2014\/09\/25\/default-quote-expirationdelivery-date-setting-in-sage-crm\/\" target=\"_blank\">Default quote expiration\/Delivery date setting in Sage CRM<\/a><br \/>\n3. <a title=\"Setting Default Date Time while progressing through Sage CRM Workflow\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2014\/02\/10\/setting-default-date-time-while-progressing-through-sage-crm-workflow\/\" target=\"_blank\">Setting Default Date Time while progressing through Sage CRM Workflow<\/a><br \/>\n4. <a title=\"Disable Date Time Picker in Sage CRM v7.2\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2013\/11\/12\/disable-date-time-picker-in-sage-crm-v7-2\/\" target=\"_blank\">Disable Date Time Picker in Sage CRM v7.2<\/a><br \/>\n5. <a title=\"Print Current Date on Mail Merge Document in Sage CRM\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2013\/08\/31\/print-current-date-on-mail-merge-document-in-sage-crm\/\" target=\"_blank\">Print Current Date on Mail Merge Document in Sage CRM<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Support of JQuery has taken up the Sage CRM customization to the higher level as JQuery has wide range of built in functions as well as its syntax to manipulate DOM elements reduces lines of code which is something every developer will like. New Stuff:\u00a0Adding Documents Tab to Leads in Sage CRM 2014 R2 Working\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95,98,103,201,332,1],"tags":[924,925,1475],"class_list":["post-9881","post","type-post","status-publish","format-standard","hentry","category-custom-page-sage-crm","category-customization","category-date","category-jquery","category-sage-crm","category-uncategorized","tag-date","tag-date-formats","tag-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"og:description\" content=\"Support of JQuery has taken up the Sage CRM customization to the higher level as JQuery has wide range of built in functions as well as its syntax to manipulate DOM elements reduces lines of code which is something every developer will like. New Stuff:\u00a0Adding Documents Tab to Leads in Sage CRM 2014 R2 Working\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\" \/>\n<meta property=\"og:site_name\" content=\"Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-24T11:10:40+00:00\" \/>\n<meta name=\"author\" content=\"greysagecrm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"greysagecrm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\",\"name\":\"Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\"},\"datePublished\":\"2015-03-24T11:10:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Displaying date fields in Nonstandard formats\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\",\"name\":\"Sage CRM \u2013 Tips, Tricks and Components\",\"description\":\"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\",\"name\":\"greysagecrm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"greysagecrm\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/","og_locale":"en_US","og_type":"article","og_title":"Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components","og_description":"Support of JQuery has taken up the Sage CRM customization to the higher level as JQuery has wide range of built in functions as well as its syntax to manipulate DOM elements reduces lines of code which is something every developer will like. New Stuff:\u00a0Adding Documents Tab to Leads in Sage CRM 2014 R2 Working\u2026 Read More &raquo;","og_url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/","og_site_name":"Sage CRM \u2013 Tips, Tricks and Components","article_published_time":"2015-03-24T11:10:40+00:00","author":"greysagecrm","twitter_card":"summary_large_image","twitter_misc":{"Written by":"greysagecrm","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/","name":"Displaying date fields in Nonstandard formats - Sage CRM \u2013 Tips, Tricks and Components","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website"},"datePublished":"2015-03-24T11:10:40+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f"},"breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2015\/03\/24\/displaying-date-fields-in-nonstandard-formats\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/"},{"@type":"ListItem","position":2,"name":"Displaying date fields in Nonstandard formats"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/","name":"Sage CRM \u2013 Tips, Tricks and Components","description":"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f","name":"greysagecrm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"greysagecrm"},"url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/9881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/comments?post=9881"}],"version-history":[{"count":0,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/9881\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/media?parent=9881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/categories?post=9881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/tags?post=9881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}