package org.gwtoolbox.commons.types.client;
import com.google.gwt.i18n.client.DateTimeFormat;
import java.util.Date;
/**
* @author Uri Boness
*/
public class TimeFormat {
private DateTimeFormat format;
public static TimeFormat getFormat(String pattern) {
return new TimeFormat(pattern);
}
private TimeFormat(String pattern) {
format = DateTimeFormat.getFormat(pattern);
}
public String format(Time time) {
Date date = new Date(time.getTime());
date.setTime(date.getTime() + date.getTimezoneOffset() * Time.MINUTE);
return format.format(date);
}
}
|