Date time declaration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 01:23 AM
Hi Team,
I need some suggestion on below script in IF condition of workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 02:48 AM
If its a future date then the below should always have a positive output
var duration1 = gs.dateDiff(now.getDisplayValue(), inputDate.getDisplayValue(), false);
ex:
*** Script: diff 4 03:30:20
And then by splitting it you can see if its more than 3 days - in the above example its 4
gs.info(parseInt(duration1.split(' ')[0]) > 3);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 02:49 AM
with my below script , its always returning NO even though end date/time and current date time has more than 3 days of diff. exp end date/time is "2024-08-23 15:14:06" and current date time is 2024-08-19 15:14:12.
if the diff is more than 3 days then it should return YES
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 02:53 AM
var endDateTime = new GlideDateTime('current.variables.end');
Remove the ' before and after current.variables.end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 03:05 AM
Hi @Simon Christens i didn't get your last comment. can you suggest what changes needs to be made on below syntax to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 03:07 AM
You need to remove the ' before and after current.variables.end inside you endDateTime gdt
var endDateTime = new GlideDateTime('current.variables.end');