Date Format for HR Document Templates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2023 06:40 AM
Hi everyone, I am having an issue where the date is being added to our HR Document Templates in the format "DD-MM-YYYY" (e.g. 19-05-2023), but I need in the format "DD MMM YYYY" (e.g. 19 May 2023). Is there a way of getting this format from all date fields when added to HR Document Templates?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2024 10:37 PM
@Georgi Ankov "Have you found a solution for this?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2024 11:14 PM
Hello @shirisha5 @Georgi Ankov
I maybe late to answer this post, but since it is unanswered I would like to give a solution to this.
Steps to meet the requirement:
- Create a Script Include that will format dates in the "DD MMM YYYY" format.
var HRDateFormatter = Class.create();
HRDateFormatter.prototype = {
initialize: function() {},
formatDate: function(date) {
if (!date) return '';
var glideDate = new GlideDateTime(date);
return glideDate.getDayOfMonthLocalTime() + ' ' +
glideDate.getMonthNameLocalTime() + ' ' +
glideDate.getYearLocalTime();
},
type: 'HRDateFormatter'
};
- Call this HRDateFormatter Script Include to format the date fields when inserting them into your document. For example, if your date field is called start_date:
var formattedDate = new HRDateFormatter().formatDate(current.start_date);
- 'formattedDate' will provide the date in "DD MMM YYYY" format, like "19 May 2023."
"If you found my answer helpful, please like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar