Comparing Date and Date/Time fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2022 04:25 PM
I am trying to write a script using a generic script, however my "Valid To" date is in Date format, not in Date/Time format.
The difference between the Valid to - Date field vs Score - Date/Time field is causing issues with the script
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.Valid_to, score_end);
- Labels:
-
Performance Analytics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2022 05:32 PM
Hello,
You can always instantiate a new GlideDateTime object and then set the value with just the date from the field that is date only, then...both objects will be in the same format and you can go from there.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!