Here you can find the source of getISOStringFromDate(long time)
Parameter | Description |
---|---|
time | - |
@SuppressWarnings("nls") public static String getISOStringFromDate(long time)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**//w w w . j av a2 s .co m * */ public static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; /** * @param time - * @return - */ @SuppressWarnings("nls") public static String getISOStringFromDate(long time) { SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(new Date(time)); } /** * @param date - * @return - */ public static String getISOStringFromDate(Date date) { SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$ return sdf.format(date); } }