summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/util/FormatHelper.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-07-08 19:39:35 +0200
committerSimon Rettberg2015-07-08 19:39:35 +0200
commit8d6cd17c330388aa13fd7c39802c7400d85f972c (patch)
tree5f2c5856f58b1454e24dc16fad10751dfe9d087b /dozentenmodul/src/main/java/util/FormatHelper.java
parentoops (diff)
downloadtutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.gz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.xz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.zip
[client] Redo package structure, add comments/TODOs, rename GUI classes
Diffstat (limited to 'dozentenmodul/src/main/java/util/FormatHelper.java')
-rw-r--r--dozentenmodul/src/main/java/util/FormatHelper.java35
1 files changed, 0 insertions, 35 deletions
diff --git a/dozentenmodul/src/main/java/util/FormatHelper.java b/dozentenmodul/src/main/java/util/FormatHelper.java
deleted file mode 100644
index ad1f02f9..00000000
--- a/dozentenmodul/src/main/java/util/FormatHelper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package util;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-
-public class FormatHelper {
-
- private static final SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- private static final SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
-
- /**
- * Convert mysql date/time format to human readable (German) format.
- * If the given date is not parsable, "<invalid>" will be returned.
- *
- * @param dateTime yyyy-MM-dd HH:mm:ss
- * @return dd.MM.yy HH:mm
- */
- public static String mysqlDateToGerman(String dateTime) {
- try {
- return out.format(in.parse(dateTime));
- } catch (ParseException e) {
- return "<invalid>";
- }
- }
-
- public static String byteToGigabyte(long bytes, boolean si) {
- int unit = si ? 1000 : 1024;
- if (bytes < unit)
- return bytes + " B";
- int exp = (int) (Math.log(bytes) / Math.log(unit));
- String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
- return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
- }
-
-}