Here you can find the source of nowUTCString()
public static String nowUTCString()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /**/*from ww w . ja v a 2 s. c o m*/ * @return - UTC Date/time */ public static String nowUTCString() { Calendar calendar = Calendar.getInstance(); TimeZone timeZone = calendar.getTimeZone(); long currentTime = System.currentTimeMillis(); int offsetWithUTC = timeZone.getOffset(currentTime); long utcTime = currentTime - offsetWithUTC; Date now = new Date(utcTime); SimpleDateFormat df = new SimpleDateFormat(); return df.format(now); } }