Here you can find the source of getJSONDate(long l)
public static String getJSONDate(long l)
//package com.java2s; /* //from w ww . j ava 2 s. co m * Copyright (C) 2012 AW2.0 Ltd * * org.aw20 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * Free Software Foundation,version 3. * * OpenBD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with org.aw20. If not, see http://www.gnu.org/licenses/ * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or combining * it with any of the JARS listed in the README.txt (or a modified version of * (that library), containing parts covered by the terms of that JAR, the * licensors of this Program grant you additional permission to convey the * resulting work. * * $Id: FileUtil.java 2981 2012-08-08 21:01:27Z alan $ */ import java.text.SimpleDateFormat; public class Main { public static String getJSONDate(long l) { return getDateString(l, "yyyy-MM-dd'T'HH:mm:ss"); } public static String getJSONDate(java.util.Date _date) { return getDateString(_date, "yyyy-MM-dd'T'HH:mm:ss"); } public static String getDateString(java.util.Date _date, String _pattern) { return new SimpleDateFormat(_pattern).format(_date); } public static String getDateString(long _epoch, String _pattern) { return new SimpleDateFormat(_pattern).format(_epoch); } }