Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
In directory
james.mmbase.org:/tmp/cvs-serv32079/src/java/com/finalist/newsletter/util
Modified Files:
Tag: b1_5
DateUtil.java
Log Message:
CMSC-1135(Add the function of input date by hand.)
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
See also: http://www.mmbase.org/jira/browse/CMSC-1135
Index: DateUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/DateUtil.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -b -r1.5 -r1.5.2.1
--- DateUtil.java 22 Sep 2008 07:53:42 -0000 1.5
+++ DateUtil.java 6 Nov 2008 08:31:34 -0000 1.5.2.1
@@ -3,6 +3,8 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -24,7 +26,12 @@
*/
public static Date parser(String raw) {
Date date = null;
-
+ String regEx = "/";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(raw);
+ if(m.find()){
+ raw = m.replaceAll("-");
+ }
if (StringUtils.isNotBlank(raw)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs