forked from I2P_Developers/i2p.i2p
Util: Consolidate and standardize date/time formatting (ticket #2016)
This commit is contained in:
@@ -279,7 +279,7 @@ public class AddressBean
|
||||
String d = getProp(key);
|
||||
if (d.length() > 0) {
|
||||
try {
|
||||
d = FormatDate.format(Long.parseLong(d));
|
||||
d = DataHelper.formatTime(Long.parseLong(d));
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
return d;
|
||||
|
@@ -1,29 +0,0 @@
|
||||
package i2p.susi.dns;
|
||||
|
||||
import java.util.Date;
|
||||
import java.text.DateFormat;
|
||||
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
/**
|
||||
* Format a date in local time zone
|
||||
* @since 0.8.7
|
||||
*/
|
||||
public abstract class FormatDate
|
||||
{
|
||||
private static final DateFormat _dateFormat;
|
||||
|
||||
static {
|
||||
DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
|
||||
// the router sets the JVM time zone to UTC but saves the original here so we can get it
|
||||
fmt.setTimeZone(SystemVersion.getSystemTimeZone());
|
||||
_dateFormat = fmt;
|
||||
}
|
||||
|
||||
public static String format(long date)
|
||||
{
|
||||
synchronized(_dateFormat) {
|
||||
return _dateFormat.format(new Date(date));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user