From 606f43f50904f7d811cf9b438e0e820e586be900 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 27 Jun 2016 13:16:43 +0300 Subject: spring-jdbc near complete --- .../java/com/juick/http/www/PageTemplates.java | 30 ++++++++-------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'src/main/java/com/juick/http/www/PageTemplates.java') diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java index 89b0c737..7021ccba 100644 --- a/src/main/java/com/juick/http/www/PageTemplates.java +++ b/src/main/java/com/juick/http/www/PageTemplates.java @@ -50,7 +50,7 @@ import ru.sape.Sape; public class PageTemplates { public static Sape sape = null; - private static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + protected static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static SimpleDateFormat sdfSimple = new SimpleDateFormat("d MMM"); private static SimpleDateFormat sdfFull = new SimpleDateFormat("d MMM yyyy"); private static String tagsHTML = null; @@ -226,7 +226,7 @@ public class PageTemplates { return ret; } - public static String formatDate(int minutes, String fulldate) { + public static String formatDate(int minutes, Date fulldate) { if (minutes < 1) { return "сейчас"; } else if (minutes < 60) { @@ -265,17 +265,16 @@ public class PageTemplates { } return days + " " + unit + " назад"; } else { - String ret = fulldate; + String ret = sdfFull.format(fulldate); synchronized (sdfSQL) { try { - Date pDate = sdfSQL.parse(fulldate); Calendar c = Calendar.getInstance(); int curyear = c.get(Calendar.YEAR); - c.setTime(pDate); + c.setTime(fulldate); if (c.get(Calendar.YEAR) == curyear) { - ret = sdfSimple.format(pDate); + ret = sdfSimple.format(fulldate); } else { - ret = sdfFull.format(pDate); + ret = sdfFull.format(fulldate); } } catch (Exception e) { System.err.println("PARSE EXCEPTION: " + fulldate); @@ -285,20 +284,11 @@ public class PageTemplates { } } - public static String formatJSLocalTime(String ts) { - String ret = ""; - synchronized (sdfSQL) { - try { - Date date = sdfSQL.parse(ts); - ret = ""; - } catch (Exception e) { - System.err.println("PARSE EXCEPTION: " + ts); - } - } - return ret; } public static String formatReplies(int replies) { @@ -452,7 +442,7 @@ public class PageTemplates { out.println("
"); out.println(" "); out.println("
@" + msg.getUser().getUName() + ":" + tagsStr + "
"); - out.println("
"); + out.println("
"); if (msg.AttachmentType != null) { String fname = msg.getMID() + "." + msg.AttachmentType; out.println("

\"\"/

"); -- cgit v1.2.3