Here you can find the source of toFormatedString(final Timestamp ts, final String timeZoneId)
Parameter | Description |
---|---|
ts | a Timestamp |
timeZoneId | Id of TimeZone |
public static String toFormatedString(final Timestamp ts, final String timeZoneId)
//package com.java2s; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.TimeZone; public class Main { public static final String STANDARD_DATETIMEFORMAT = "dd.MM.yyyy HH:mm"; /**/*from ww w.ja va 2 s . c om*/ * @param ts a Timestamp * @param timeZoneId Id of TimeZone * @return a String formated with SimpleDateFormat */ public static String toFormatedString(final Timestamp ts, final String timeZoneId) { SimpleDateFormat df = new SimpleDateFormat(STANDARD_DATETIMEFORMAT); df.setTimeZone(TimeZone.getTimeZone(timeZoneId)); return df.format(ts.getTime()); } }