summaryrefslogtreecommitdiff
path: root/shared/MyDate.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2009-02-18 17:33:22 +0000
committerPaul Buetow <paul@buetow.org>2009-02-18 17:33:22 +0000
commit4722100cba287b164957c658c2e035783e20c963 (patch)
tree35733fd3e50aeeb493e38ceaea83521a4710f0ac /shared/MyDate.java
parent61f7175cc3e51c0afaf63e380d03824a77464ba8 (diff)
moved sources
Diffstat (limited to 'shared/MyDate.java')
-rw-r--r--shared/MyDate.java54
1 files changed, 0 insertions, 54 deletions
diff --git a/shared/MyDate.java b/shared/MyDate.java
deleted file mode 100644
index 00bf59d..0000000
--- a/shared/MyDate.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package shared;
-
-import java.util.*;
-
-/**
- * This class extends the standard Date class and customizes the toString method.
- * This class also contains some helper methods to make the life easier.
- * @author buetow
- *
- */
-public class MyDate extends Date {
- private final static long serialVersionUID = 1L;
- private final static String [] DAYS = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-
- /**
- * Copy constructor.
- * @param data Specifies the date objekt to copy the time from.
- */
- public MyDate(Date date) {
- super(date.getTime());
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(this);
-
- String sYear = addZerosToFront(calendar.get(Calendar.YEAR), 4);
- String sMonth = addZerosToFront(calendar.get(Calendar.MONTH) + 1, 2);
- String sDays = addZerosToFront(calendar.get(Calendar.DAY_OF_MONTH), 2);
- String sHours= addZerosToFront(calendar.get(Calendar.HOUR), 2);
- String sMinutes = addZerosToFront(calendar.get(Calendar.MINUTE), 2);
- String sDay = DAYS[calendar.get(Calendar.DAY_OF_WEEK)-1];
-
- return sDays + "." + sMonth + "." + sYear + " " + sHours + ":" + sMinutes + " " + sDay;
- }
-
- /**
- * This method adds zeros in front of a number and returns it as a string.
- * @param iValue Specifies the number to add zeros to.
- * @param iWantedLength Specifies the wanted max length of the string.
- * @return Returns the number represented as a string with additional zeros on front.
- */
- public static String addZerosToFront(int iValue, int iWantedLength) {
- String sValue = iValue + "";
-
- while (sValue.length() < iWantedLength)
- sValue = "0" + sValue;
-
- return sValue;
- }
-}