Here you can find the source of getCurrentUTCTime()
public static Date getCurrentUTCTime()
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { static final String DATEFORMAT = "yyyy-MM-dd"; public static Date getCurrentUTCTime() { try {// w ww.j ava 2 s . c o m return stringDateToDate(getCurrentUTCTimeAsString()); } catch (ParseException e) { e.printStackTrace(); } return null; } public static Date stringDateToDate(String StrDate) throws ParseException { Date dateToReturn = null; SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT); try { dateToReturn = (Date) dateFormat.parse(StrDate); } catch (ParseException e) { e.printStackTrace(); } return dateToReturn; } public static String getCurrentUTCTimeAsString() { final SimpleDateFormat sdf = new SimpleDateFormat(DATEFORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); final String utcTime = sdf.format(new Date()); return utcTime; } public static String format(Date date) { SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT); return dateFormat.format(date); } }