Groovy web console

subscribe to the feed Subscribe
to this
site

Gotilla

Published 4 months ago by nanalla with tags Anything
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def date = new Date() 
println date
def dtFormat = "yyyy-MM-dd'T'HH:mm:ssZ" 
def dt = date.format(dtFormat, TimeZone.getTimeZone('IST'))
println dt
assert dt instanceof String  
def newDate = Date.parse(dtFormat, dt) 
assert newDate instanceof Date
println newDate