Script to amend request subject not working properly - incorrect date format

Script to amend request subject not working properly - incorrect date format

Hi everyone,

Hoping someone can help me. I have a script running that pulls information from the request details and adds them into the subject for my new starter request. The issue is, one of the fields i am pulling is a custom field for the employees start date, however when this pulls through it comes through as below:

EMPLOYEE NAME: Daniel Walker START DATE: Mon May 27 2019 16:02:00 GMT+0100 (British Summer Time) DEPARTMENT: Service Desk

The highlighted area is showing the full time and timezone but i just want the date and want it look like below:

EMPLOYEE NAME: Daniel Walker START DATE: 27/05/2019 DEPARTMENT: Service Desk

Does anyone know if this is possible within the script to amend the date format? The script i am using is below:

Thanks all.

  1. if($CS.isFormSubmit())
  2. {
  3. var employee=$CS.getValue("ServiceReq_User_UDF_CHAR1"); 
  4. var startdate=$CS.getValue("ServiceReq_User_UDF_DATE1");  
  5. var dept=$CS.getValue("ServiceReq_User_UDF_CHAR2");
  6. var subject = $CS.getValue("SUBJECT");
  7. subject =  "EMPLOYEE NAME: " + employee + " START DATE: " + startdate + " DEPARTMENT: " + dept;
  8. $CS.setValue("SUBJECT", subject);

                New to ADSelfService Plus?