Groovy web console

subscribe to the feed Subscribe
to this
site
Formatted Date & Time in Timezone (via #groovywebconsole)
tweet this snippet Tweet
this
script

Formatted Date & Time in 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)