how to calculate the days count between system date and current date in another field on item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 03:18 AM
We have a catalog item which required to fill a date in one field and then in another field days count need to be show .
for example user filled 25/03/2024
and my system date is 22/03.2024
then days count will appear 3 in days count.
Screenshot attached
Please suggest how to achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 04:47 AM
Hi @Anuj30 ,
Inside your script include after receiving the user entered date to get current system date time use below :
var gdt = new GlideDateTime();
and then you can use the difference method to calculate the difference between these two dates and get the day part.
Please mark correct/helpful if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 02:10 AM
Hi Anuj
Did you ever get this sorted? I have a very similar requirement. If you worked it out, please could you share?
Thanks
Jonny