to check if a date falls in between two other dates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2017 07:06 AM
Hi
Here is my situation
I have a custom table (expense lines) which has a Date field. I need to check if the date falls between a specific fiscal period. The fiscal periods are in the fiscal_period table. the Fiscal Period would have periods like below
Once I get the fiscal period I need to validate if the said record in Expense lines matches the fiscal period in the cost plan table
Can someone help me with a script on this
Much appreciate
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2017 08:01 AM
Use this way, the validation for date is to check in between or not,
var dateValidation = false;
var apprDate = new GlideDateTime(approveDate);// approve start date | |||
var compDate = new GlideDateTime(compareDate);//onChange date | |||
var renDate = new GlideDateTime(renewalDate);// approve end date | |||
var res1 = gs.dateDiff(apprDate.getDisplayValue(),compDate.getDisplayValue(),true); | |||
var res2 = gs.dateDiff(compDate.getDisplayValue(),renDate.getDisplayValue(),true); | |||
if (res1>0 && res2>0){ | |||
dateValidation = true; | ; | ||
} | |||
return dateValidation; | |||
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2017 08:03 AM
Let me try this and I will reply back
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2017 09:29 AM
There is a Script Includes OOB called FiscalPeriodHelper. In that we have a method like this
fiscalPeriodForDate which accepts a dateTime. So you can get the Fiscal period for the corresponding DateTime from that. Will that be useful for you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 08:08 AM
Hi Arun
I am using the OOB Script include. I had to make some changes but. Thanks for pointing it out. Appreciate it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2017 07:11 AM
Where is the OOB Script Include...Have the plugin enabled but do not see this script include.