Here you can find the source of getCurrentDateAndTime()
public static String getCurrentDateAndTime()
//package com.java2s; /*//from w w w. j a v a2 s . co m * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.uportal.org/license.html */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentDateAndTime() { return getFormattedDateAndTime(new Date()); } public static String getFormattedDateAndTime(final Date date) { final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); // Google Does not set this. // dateFormat.setTimeZone(UTC_TIME_ZONE); return dateFormat.format(date); } }