Java Json getJSONDate(long l)

Here you can find the source of getJSONDate(long l)

Description

get JSON Date

License

Open Source License

Declaration

public static String getJSONDate(long l) 

Method Source Code

//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);
    }
}

Related

  1. fill_key_value(JsonObjectBuilder jsonObject, String key, Object value)
  2. fill_list(JsonObjectBuilder jsonObject, String key, List list)
  3. fromDictionary(Map dictionary)
  4. getAsJSONArray(Object obj)
  5. getFromGson(String json, Class clazz)
  6. getJsonMapper()
  7. hasKey(JsonObject object, String name)
  8. jsonEquals(JsonArray expected, JsonArray actual, boolean strict)
  9. jsonObject(String key, JsonValue val)

  10. HOME | Copyright © www.java2s.com 2016