- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2020 12:57 PM
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.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 08:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2020 01:03 PM
Due date is a date time field you can't remove the time. The best option is probably to set it to the end of the day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2020 01:14 PM
LJ Hazel is correct. Due Date is a Date Time field. If you want to capture just the date, creating a new 'Date' type field would be one option. Otherwise, you can set Due Date to a specific time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2020 01:15 PM
What would the code look like to add 12 hours?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2020 10:15 PM
If the due date is date/time, then you cannot just populate date in it. Even if you try to do it, it will add 00:00:00 to the date and show it bcoz its a date/time field.
However, if you want to fetch only date from the date/time field, then you can do like this.
task.due_date = current.variables.requested_date.getDisplayValue();
var gdt = new GlideDateTime(current.variables.requested_date).getDate();
gs.print(gdt);
Mark the comment as a correct answer and also helpful if it helps.