Get Day Part of datediff in Report Function Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 12:42 AM
I'm trying to create a report where I'm capturing the difference between a date field and sys_created_on which is a date/time field.
For function field, however, when I use datediff function I only want the Day part and not the hours, minutes and seconds part of the duration value.
I tried this:
glidefunction:datediff(submitted_at,sys_created_on).getDayPart()
and
glidefunction:datediff(submitted_at,sys_created_on.getDate())
However, neither are working and are returning empty values.
This should be possible right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 05:27 AM
Hi @Aditya Raute ,
You can try a script similar to :
var start = new GlideDateTime('current.submitted_at');
var end = new GlideDateTime('current.sys_created_on');
var diff = GlideDateTime.subtract(start, end);
var days = diff.getRoundedDayPart();
current.u_total_number_of_days = days;
Please mark helpful and accept solution if it helped you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 05:29 AM
this is in scripting
But we cannot use these functions in 'Function Fields' of a table