
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 04:17 AM - edited 02-28-2023 04:19 AM
Hi All,
We have two date fields A and B. A will auto populate with some date value from inbound integration, need to subtract this date with 15 months and populate it on B date field. How can we subtract A date field value with 15 months.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 04:23 AM - edited 02-28-2023 04:32 AM
@Anil74, You can use gs.monthsAgo(15) function to get a 15 months before today's date. Please refer below SS for syntax :
You can use below code to get 15 months date before a given date (not today's date) :
Please mark helpful and accept solution if it helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 04:23 AM - edited 02-28-2023 04:32 AM
@Anil74, You can use gs.monthsAgo(15) function to get a 15 months before today's date. Please refer below SS for syntax :
You can use below code to get 15 months date before a given date (not today's date) :
Please mark helpful and accept solution if it helped you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 04:48 AM
Hi @Abhishek Singh6 , Thank you for quick reply. Its working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 04:38 AM
Hi,
You can do this with a business rule, that runs when date A changes.
In the script you set date B by subtracting months from date A.
Example below:
var date1 = new GlideDateTime(current.getValue('some_date_A'));
date1.addMonthsUTC(-15);
current.setValue('some_date_B', date1.getValue());