Groovy web console

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

working hours

Published 1 year 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