Here you can find the source of getNowAsString()
public static String getNowAsString()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { public static String getNowAsString() { Calendar cal = Calendar.getInstance(); SimpleDateFormat ISO8601Local = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); TimeZone timeZone = TimeZone.getDefault(); ISO8601Local.setTimeZone(timeZone); return ISO8601Local.format(cal.getTime()); }// w ww . java 2 s. co m }