- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 12:37 PM
Good afternoon,
In Change Request, we have planned_start/end_date fields that are glidedatetime.
We also have an implementation_date that is glidedate,
And an implementation_start_time that is glidetime.
I am being asked to report on instances where the implementation date is before the start date or after the end date. I don't suppose there is something easy I am not seeing to compare different types of time fields? I don't think the conditions I can come up with can handle it where the DATE is the same day, and I want to compare the times.
I suppose I could fixscript a new glidedatetime field that combined the DATE and TIME into a DATETIME and use that, but I really would rather not edit years (and years) worth of CHG just to accomplish this. Better ideas?
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 12:51 PM
Hi,
You'd want to use the GlideDateTime API and pass in values (such as the date, from the Imp Date) and then time from the GlideTime.
Those combined, will give you what you need to then compare GlideDateTime to GlideDateTime.
Checkout the GlideDateTime API for examples on "setValue" for that object:
Rough example could be something like:
//glidrecord query to find your record with variable gr
//now you have access to the record via gr so you can do things like
var gdTime = gr.getValue('glide_date_time_field');
var gdDate = gr.getValue('glide_date_field');
var gdt = new GlideDateTime();
gdt.setValue(gdDate gdTime);
//conduct more script from here
The above is a rough example of just showing how to retrieve that information and then create a combined date/time object. You need to get the string for the date and time to use it with setValue.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 12:51 PM
Hi,
You'd want to use the GlideDateTime API and pass in values (such as the date, from the Imp Date) and then time from the GlideTime.
Those combined, will give you what you need to then compare GlideDateTime to GlideDateTime.
Checkout the GlideDateTime API for examples on "setValue" for that object:
Rough example could be something like:
//glidrecord query to find your record with variable gr
//now you have access to the record via gr so you can do things like
var gdTime = gr.getValue('glide_date_time_field');
var gdDate = gr.getValue('glide_date_field');
var gdt = new GlideDateTime();
gdt.setValue(gdDate gdTime);
//conduct more script from here
The above is a rough example of just showing how to retrieve that information and then create a combined date/time object. You need to get the string for the date and time to use it with setValue.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2021 06:08 AM
This will do nicely; perfect.
Thank you,
Jeff