Util: Consolidate and standardize date/time formatting (ticket #2016)

This commit is contained in:
zzz
2019-08-30 18:38:12 +00:00
parent 96d8385f49
commit a6e3621c06
25 changed files with 101 additions and 159 deletions

View File

@@ -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;

View File

@@ -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));
}
}
}