Groovy web console

subscribe to the feed Subscribe
to this
site
comparar datas (via #groovywebconsole)
tweet this snippet Tweet
this
script

comparar datas

Published 4 months ago by Gleds3000 with tags compare date
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
//String teste = "testesssss"

//return teste.length()

//Define the date format as per your input 
def df = "dd.MM.yyyy HH:mm:ss,S"  
//Parse the date string with above date format
def dateTime1 = new Date().parse(df, "13.07.2017 14:03:51,469000000") 
def dateTime2 = new Date().parse(df, "13.07.2017 14:03:52,469000000")  
//Compare both date times 
//assert 
return dateTime1 < dateTime2