Here you can find the source of currentTime()
public static String currentTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String currentTime() { SimpleDateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH); //df.setTimeZone(TimeZone.getTimeZone("GMT+08:00")); String sendtime = df.format(new Date()); return sendtime; }//www . j a va2s. com }