Here you can find the source of getCurrentUTCTimeAsString()
public static String getCurrentUTCTimeAsString()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { static final String DATEFORMAT = "yyyy-MM-dd"; public static String getCurrentUTCTimeAsString() { final SimpleDateFormat sdf = new SimpleDateFormat(DATEFORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); final String utcTime = sdf.format(new Date()); return utcTime; }/*from w w w .j a v a 2 s. co m*/ public static String format(Date date) { SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT); return dateFormat.format(date); } }