Remove time from Date Time field

jeremyjameshans
Mega Guru

Hello,

I would like to strip out the time on the Due Date field for my Catalog Tasks.

 

My script to populate is very simple: 

 

task.due_date = current.variables.requested_date.getDisplayValue();

 

Is there a way to strip out the time? 

I have tried getLocalDate() and failed badly. 

 

1 ACCEPTED SOLUTION

jeremyjameshans
Mega Guru

Thank you Arthur,  that is good advice. 

View solution in original post

6 REPLIES 6

Miguel Donayre
ServiceNow Employee
ServiceNow Employee

Another solution I have seen in the past is to create a new column type "Date" and tie it to the "date/time field" with a script to populate it with just the date from the "date/time" and show that on the form or whatever you need it for. That way it will always show just the date.

 

jeremyjameshans
Mega Guru

Thank you Arthur,  that is good advice.