Here you can find the source of timestampToString(final Date ts, final String format, final String tzId)
Parameter | Description |
---|---|
ts | a parameter |
format | a parameter |
tzId | a parameter |
public static String timestampToString(final Date ts, final String format, final String tzId)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**/*from ww w . j a v a2 s . co m*/ * * @param ts * @param format * @param tzId * @return * * @author Anton Nedbailo * @date Sep 29, 2013 */ public static String timestampToString(final Date ts, final String format, final String tzId) { Date ret = ts; SimpleDateFormat formatter = new SimpleDateFormat(format); formatter.setTimeZone(TimeZone.getTimeZone(tzId)); if (ret == null) { ret = new Date(); } return formatter.format(ret); } }