Skip to content

Filter functionality - Groovy or Java Packages? #3780

Discussion options

You must be logged in to vote

I was attempting

import groovy.time.*

def startString = "2023-05-02T16:44:55.362871439Z"
def endString = "2023-05-03T16:44:55.362871439Z"

def start = Date.parse("yyyy-MM-dd'T'HH:mm:ss",startString)
def end = Date.parse("yyyy-MM-dd'T'HH:mm:ss",endString)

def timeAllowed = new Duration(0,2,0,0,0)

TimeDuration duration = TimeCategory.minus(end, start)

duration.toMilliseconds() > timeAllowed.toMilliseconds()

^ This was never showing results despite always being true.

However, I've successfully managed to another script to work using Java and its packages, by using

import java.text.SimpleDateFormat; import java.util.Date;

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@DanielVeale-Shipt
Comment options

Answer selected by Haarolean
@DanielVeale-Shipt
Comment options

@Haarolean
Comment options

@mrittlinger
Comment options

@DanielVeale-Shipt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants