Time Field Comparison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 08:06 PM
Hello All,
We have a requirement to compare current time with 2 time (not date/time) fields of custom table. If the current time is in between the above two time fields. We have used following logic which is mostly working fine but sometime not working fine for system time zone. Could anyone help me with this?
Logic used:
var currentTime = new GlideDateTime().getLocalTime().getDisplayValueInternal(); // Get Current Local Time
var begTime = new GlideDateTime(grHRAssociate.u_beginning_time).getLocalTime().getDisplayValueInternal();
var endTime = new GlideDateTime(grHRAssociate.u_end_time).getLocalTime().getDisplayValueInternal();
if ( currentTime >= begTime && currentTime <= endTime &&) {
agents.push(grHRAssociate.u_hr_associate.toString());
}
Thank you!
- Labels:
-
Scripting and Coding