From 463277179690228487c4880df1f44e60301d42ec Mon Sep 17 00:00:00 2001 From: ravichandra1998g <149189748+ravichandra1998g@users.noreply.github.com> Date: Fri, 27 Oct 2023 23:37:56 +0530 Subject: [PATCH] Create DateComparison.js syntax macro to compare the dates Check whether the current date time is greater than start date time and less than end date time. (in a form or record producer). --- Date Time/DateComparison.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Date Time/DateComparison.js diff --git a/Date Time/DateComparison.js b/Date Time/DateComparison.js new file mode 100644 index 0000000..2a5a38e --- /dev/null +++ b/Date Time/DateComparison.js @@ -0,0 +1,11 @@ +/*Check whether the current date time is greater than start date time and less than end date time. add start and end date as per your need*/ +var getCurrentDate = new GlideDateTime(); //getting the current date +var start = '2023-08-08 05:55:13'; +var end = '2023-08-10 05:55:13'; +if((getCurrentDate > start) && (getCurrentDate < end)){ //comparing the current date +    gs.print(start); +    gs.print(end) +} +else{ +gs.print(getCurrentDate); +}