Groovy web console

subscribe to the feed Subscribe
to this
site
Format date string (via #groovywebconsole)
tweet this snippet Tweet
this
script

Format date string

Published 7 months ago by Daniel Pawluk
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.text.SimpleDateFormat;


SimpleDateFormat fmt = new SimpleDateFormat("YYYY-MM-dd");
gc = new GregorianCalendar();
my_date = gc.getTime();
my_string = fmt.format(my_date);
print(my_string);