How to get use date in function field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2022 10:09 AM
I am using function field and want to get just the date difference. I used the following and it returns the hours/minutes etc.
glidefunction:datediff(now(), start_date)
what can I use to replace now () to just get the date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2022 10:47 AM
I get this : 41 Days 18 Hours 44 Minutes
instead I want only 41 Days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2022 11:08 AM
try something like below code,
var v1 = new GlideRecord('your_table_name');
v1.query();
while(v1.next()){
var g1 = new GlideDate('start_date');
var g2 = new GlideDate(gs.now());
var sub = new GlideDate.subtract(g1,g2);
gs.info('Testing'+' '+sub.getDisplayValue());
}
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke