husted 2002/11/13 11:15:31
Modified: scaffold/src/java/org/apache/commons/scaffold/text
ConvertUtils.java
Log:
+ ConvertUtils: Add and refactor some Timestamp methods.
Revision Changes Path
1.6 +40 -9
jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/text/ConvertUtils.java
Index: ConvertUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/text/ConvertUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConvertUtils.java 13 Nov 2002 12:46:11 -0000 1.5
+++ ConvertUtils.java 13 Nov 2002 19:15:30 -0000 1.6
@@ -577,9 +577,9 @@
* http://java.sun.com/j2se/1.4/docs/api/java/text/SimpleDateFormat.html
* @author Hal Deadman
*/
- public static Date getDate(String dateText,
+ public static Date getDate(String dateDisplay,
String format, boolean lenient) {
- if (dateText == null) {
+ if (dateDisplay == null) {
return null;
}
DateFormat df = null;
@@ -593,7 +593,7 @@
// setLenient avoids allowing dates like 9/32/2001
// which would otherwise parse to 10/2/2001
df.setLenient(false);
- return df.parse(dateText);
+ return df.parse(dateDisplay);
}
catch(ParseException e) {
return null;
@@ -607,8 +607,8 @@
* Uses "strict" coNversion (lenient=false).
* @author Hal Deadman
*/
- public static Date getDate(String dateString, String format) {
- return getDate(dateString,format,LENIENT_DATE);
+ public static Date getDate(String dateDisplay, String format) {
+ return getDate(dateDisplay,format,LENIENT_DATE);
}
@@ -618,8 +618,8 @@
* Uses "strict" coNversion (lenient=false).
* @author Hal Deadman
*/
- public static Date getDate(String dateString) {
- return getDate(dateString,null,LENIENT_DATE);
+ public static Date getDate(String dateDisplay) {
+ return getDate(dateDisplay,null,LENIENT_DATE);
}
@@ -707,7 +707,13 @@
* Escape string to create Timestamp representing
* "January 1, 1970 00:00:00".
*/
- public static String NULL_TIMESTAMP_TEXT = "1970-01-01 00:00:00";
+ public static String NULL_TIMESTAMP_DISPLAY = "1970-01-01 00:00:00";
+
+
+ /**
+ * @deprecated Use NULL_TIMESTAMP_DISPLAY.
+ */
+ public static String NULL_TIMESTAMP_TEXT = "NULL_TIMESTAMP_DISPLAY";
/**
@@ -724,6 +730,31 @@
* Timestamp representing "January 1, 1970 00:00:00".
*/
public static Timestamp NULL_TIMESTAMP = new Timestamp(NULL_TIME);
+
+
+
+ /**
+ * Return the String representing "January 1, 1970 00:00:00".
+ */
+ public static String getTimestampDisplayNull() {
+ return NULL_TIMESTAMP_DISPLAY;
+ }
+
+
+ /**
+ * Return the String representing the current timestamp;
+ */
+ public static String getTimestampDisplay() {
+ return getTimestamp(new Timestamp(System.currentTimeMillis()));
+ }
+
+
+ /**
+ * @deprecated Use getTimestampDisplay.
+ */
+ public static String getTimestampText() {
+ return getTimestampDisplay();
+ }
/**
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>