Remove time from date/time field

brostoff17
Tera Contributor

I want to remove the time from a date/time field that is already existing.   It looks like I cannot change the field type to just "date".   However, I dont want to deactivate the field or have to create a new field.

Is there a way I can add an attribute to the field so it doesnt display the time?

Capture.PNG

13 REPLIES 13

lks
ServiceNow Employee
ServiceNow Employee

Hello Josh,



I would suggest you to create a new dictionary field (date or string) on your choice of table and enable the "Calculated" checkbox. Then in calculation field use below script respectively:



//Field type as Date


return current.sys_created_on.split(" ")[0];



//Field type as string


current.sys_created_on.split(" ")[0];



I hope it will answer your purpose 🙂


lks
ServiceNow Employee
ServiceNow Employee

Hello Josh,



Were you able to make any progress on it and completed your task?


Vladimir Lensu
Giga Contributor

Maybe somebody can create an Enhancement HI Ticket to add an Attribute to Date/Time field to hide Time portion from view? Many clients are asking for this.

This would be the ideal solution.  Does anyone know whether or not ServiceNow has addressed this issue yet?

maymunTesm
Kilo Expert

Hi,

 

I know this isn't quite a solution, but it is something that works. 

If you delete all records in the table you are doing this on, then you can change the field to just date. This is because the field is currently being used for a date and time, so the system doesn't want you to change it

If this is a small custom table or something small that you don;t mind deleting all data for, then this is a possible option as it worked well for me in Special Handling notes.

 

Best regards,

Maymun