Here you can find the source of getCurrentUTCString()
public static String getCurrentUTCString()
//package com.java2s; /*//from w ww . j a v a 2s . c o m * License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt */ import java.text.NumberFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /** * Get current date in yyyy-dddThh:mm:ss.sss format (GMT) * @return current date string */ public static String getCurrentUTCString() { NumberFormat i3 = NumberFormat.getInstance(); NumberFormat i2 = NumberFormat.getInstance(); i3.setMinimumIntegerDigits(3); i2.setMinimumIntegerDigits(2); Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); String date = cal.get(Calendar.YEAR) + "-" + i3.format(cal.get(Calendar.DAY_OF_YEAR)) + "T" + i2.format(cal.get(Calendar.HOUR_OF_DAY)) + ":" + i2.format(cal.get(Calendar.MINUTE)) + ":" + i2.format(cal.get(Calendar.SECOND)) + "." + i3.format(cal.get(Calendar.MILLISECOND)); return date; } }