You will want to learn about SimpleDateFormat
.
The basics for getting the current time in ISO8601 format:
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ");
String now = df.format(new Date());
For other formats:
DateFormat df = new SimpleDateFormat("MMM d, yyyy");
String now = df.format(new Date());
or
DateFormat df = new SimpleDateFormat("MM/dd/yy");
String now = df.format(new Date());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…