Groovy web console

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

working hours

Published 4 months ago by rookie with tags #date #comparison
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import java.text.SimpleDateFormat
def date = new Date()
sdf = new SimpleDateFormat("HH")
String currentHh = sdf.format(date)

if (currentHh < "09" || currentHh > "19") {
  println "Do not send email"
} else {
  println "currentHh is woring hours " + currentHh
}