Groovy web console

subscribe to the feed Subscribe
to this
site
Formatted date with Timezone (via #groovywebconsole)
tweet this snippet Tweet
this
script

Formatted date with Timezone

Published 1 month ago by Mak with tags date time timezone
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def d = new Date()
def tz = TimeZone.getTimeZone('IST')
//def tz = TimeZone.getTimeZone('GMT+1')
String date = d.format('dd/MMM/yyyy hh:mm:ss a', tz)