Here you can find the source of toDateTimeString(long timestamp)
Parameter | Description |
---|
public static String toDateTimeString(long timestamp)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.text.SimpleDateFormat; public class Main { /**/*from w w w . jav a 2 s. c o m*/ * Converts a timestamp to string yyyy-mm-dd hh:mm:ss * @param long timestamp unix style timestamp */ public static String toDateTimeString(long timestamp) { String DATE_FORMAT = "yyyy-MM-dd"; String TIME_FORMAT = "HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat stf = new SimpleDateFormat(TIME_FORMAT); return sdf.format(new Date(timestamp)) + "T" + stf.format(new Date(timestamp)); } }