The Now Platform® Washington DC release is live. Watch now!
10-24-2017 02:02 AM
Hi,
I have two fields glide date(Start Date,End Date) and glide date time(Process Date) fields.
If the fields are having the dates as below am trying to fetch the records which has the condition Process Date > Start Date and Process Date < End Date
Ex:
Start Date - 1:10:2017 End Date - 31:10:2017
Process Date - 31:10:2017 11:59:59
I am able to get all the records which has the date between 1:10:2017 and 31:10:2017 except the last day of the month (Ex: 31:10:2017 10:00:00)
Please suggest the possible ways to get those records as well.
Thanks in Advance.
10-24-2017 02:12 AM
Hi,
It better to get the date out of process date with glideDateTiime Object and then run the comparison.
var gdt = new GlideDateTime("31-10-2017 11:59:59"); // place your porcess date field here
var pdt=gdt.getDate();
if(pdt>start_date && pdt<end_date){
//peform action
}
Thanks
Gaurav
10-24-2017 02:25 AM
But i need the records which has the dates as Ex:31-10-2017 11:59:59 or 31-10-2017 08:59:59 i.e between 31st and 1st also which covers the whole 31st day
10-24-2017 02:12 AM
The reason why you unable to fetch is Start Date & End Date type is Date filed whereas Process Date type is Date & Time type.
You need to write script to convert them in millisec later you can query your condition:
something like this.!
var dateTimeStr = g_form.getValue('u_date_time'); // Process Date & Time type
var dateArr = dateTimeStr.split(' ');
var Processdate = dateArr[0]; // Splitting and taking only Date value
Later you query your condition just like this:
if (Processdate > "Start Date label name /")
{
//do something
}
Abdul Azeez
PS - Please mark Helpful, Like, or Correct Answer if applicable.
10-24-2017 02:17 AM
If i Do this I think I will not be able to get the records where the process date is having the date as (31:10:2017 11:59:59).
I need those records as well which includes the whole the last day (31st) and before the next day(1st)