Here you can find the source of getTimestamp()
public static String getTimestamp()
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { public static String getTimestamp() { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("UTC")); Calendar c = Calendar.getInstance(); TimeZone z = c.getTimeZone(); int offset = z.getRawOffset(); if (z.inDaylightTime(date)) { offset = offset + z.getDSTSavings(); }//w w w.j av a 2s . c o m int offsetHrs = offset / 1000 / 60 / 60; DecimalFormat formatter = new DecimalFormat("00"); return (format.format(date) + "+" + formatter.format(offsetHrs) + ":00"); } }