Update of /cvsroot/roller/roller/src/org/roller/util
In directory sc8-pr-cvs1:/tmp/cvs-serv24457/src/org/roller/util
Modified Files:
DateUtil.java Utilities.java
Log Message:
ISO-8601 date in RSS channel header allows us to validate again as RSS 2.0
Index: DateUtil.java
===================================================================
RCS file: /cvsroot/roller/roller/src/org/roller/util/DateUtil.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DateUtil.java 5 Feb 2003 17:40:17 -0000 1.4
--- DateUtil.java 17 Feb 2003 15:44:53 -0000 1.5
***************
*** 23,26 ****
--- 23,29 ----
new SimpleDateFormat("yyyyMMdd");
+ private static SimpleDateFormat mFormatIso8601 =
+ new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+
//-----------------------------------------------------------------------
/**
***************
*** 275,278 ****
--- 278,296 ----
{
return DateUtil.format(date, mFormat8chars);
+ }
+
+ //-----------------------------------------------------------------------
+ // This is a hack, but it seems to work
+ public static String formatIso8601(Date date)
+ {
+ // Add a colon 2 chars before the end of the string
+ // to make it a valid ISO-8601 date.
+
+ String str = DateUtil.format(date,mFormatIso8601);
+ StringBuffer sb = new StringBuffer();
+ sb.append( str.substring(0,str.length()-2) );
+ sb.append( ":" );
+ sb.append( str.substring(str.length()-2) );
+ return sb.toString();
}
Index: Utilities.java
===================================================================
RCS file: /cvsroot/roller/roller/src/org/roller/util/Utilities.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Utilities.java 8 Feb 2003 05:40:32 -0000 1.15
--- Utilities.java 17 Feb 2003 15:44:53 -0000 1.16
***************
*** 9,12 ****
--- 9,13 ----
import java.io.InputStream;
import java.io.OutputStream;
+ import java.util.Date;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
***************
*** 98,101 ****
--- 99,103 ----
}
+ //------------------------------------------------------------------------
/**
* Escape, but do not replace HTML.
***************
*** 107,110 ****
--- 109,113 ----
}
+ //------------------------------------------------------------------------
/**
* Escape, but do not replace HTML.
***************
*** 126,129 ****
--- 129,142 ----
}
+ //------------------------------------------------------------------------
+ /**
+ * Format date in ISO-8601 format.
+ */
+ public static String formatIso8601Date(Date d)
+ {
+ return DateUtil.formatIso8601(d);
+ }
+
+ //------------------------------------------------------------------------
/** Run both removeHTML and escapeHTML on a string.
* @param s String to be run through removeHTML and escapeHTML.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
|