var CalAge = Class.create();
CalAge.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
generateAge: function() {
var dob = this.getParameter('sysparam_id');
var today = new GlideDateTime();
var todayYear = today.getYearLocalTime();
var bday = new GlideDateTime(dob.toString());
var bdayYear = bday.getYearLocalTime();
var age =todayYear - bdayYear;
return age;
},
type: 'CalAge'
});
/** To run tyhe above code type the following code in Background script and run
var dob1 = new CalAge.generateAge('23-07-2017');
gs.print(dob1);
**/
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter