var gr = new GlideRecord("incident"); gr.addQuery("sys_id",current.sys_id) gr.query(); if(gr.next()) { var nd = new GlideDateTime(gr.sys_created_on); var fd = new GlideDateTime(nd); var dateToPrint = fd.getDate(); gs.print(dateToPrint.getByFormat('MMM-dd-YYYY')); }
Output:
How to change date format in notification using mail script ServiceNow
Working Code Asked question August 8, 2023