- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 03:12 AM
Hi All,
Could any one help me on following requirement.
How do I get number of days on current date. For example today date is 1-6-2022 and result I want is Number of days is 6
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 05:30 AM
I tried this on my PDI, and Working fine.
var currentdate = new GlideDate();
gs.print(currentdate.getDayOfMonthNoTZ());
Output:
*** Script: 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 05:30 AM
I tried this on my PDI, and Working fine.
var currentdate = new GlideDate();
gs.print(currentdate.getDayOfMonthNoTZ());
Output:
*** Script: 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 06:38 AM
hey,
was that useful? Please mark correct answer if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 04:04 AM
Hi,
Please use below to get the result:
var start = new GlideDateTime('Date 1 Field Value');
var end = new GlideDateTime('Date 2 Field Value');
var diff = GlideDateTime.subtract(start, end);
var days = diff.getRoundedDayPart();
gs.info(days);
For example something like below:
var start = new GlideDateTime('2021-05-17 00:00:00');
var end = new GlideDateTime('2021-05-18 23:59:59');
var diff = GlideDateTime.subtract(start, end);
var days = diff.getRoundedDayPart();
gs.print(start);
gs.print(end);
gs.print(days);
*** Script: 2021-05-17 00:00:00
*** Script: 2017-05-18 23:59:59
*** Script: 2
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 05:15 AM
Did you try the solution proposed above, works for me. let me know if you are facing an issue and also a screenshot of the fields of your form will be good to have along with script which you have written.
Regards,
Shloke
Regards,
Shloke