- 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 03:21 AM
Hi,
You can calculate the difference between 2 dates.
Try writing below in background scripts. And use according to your requirement.
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 03:42 AM
not like this.. it's calculate based on today date suppose today date is 1-6-2022 and I want system will return number of days is 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 03:51 AM
Do you need this from year start or month start.
for an example today is 5-02-2022, So from the year start it is 36 days.
But if we calculate from the month start then it will be 5.
So from where you have to calculate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 04:49 AM
month start.