You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2005/10/18 23:42:30 UTC

svn commit: r326259 - /incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java

Author: agilliland
Date: Tue Oct 18 14:42:25 2005
New Revision: 326259

URL: http://svn.apache.org/viewcvs?rev=326259&view=rev
Log:
oops, changed a little too much with the timezone fix.  reverting a couple changes.


Modified:
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java?rev=326259&r1=326258&r2=326259&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/formbeans/WeblogEntryFormEx.java Tue Oct 18 14:42:25 2005
@@ -108,16 +108,19 @@
             
             TimeZone timezone = entry.getWebsite().getTimeZoneInstance();
             try {
-                // gather submitted pubtime in a string
-                String time = getHours()+":"+getMinutes()+":"+getSeconds();
-                String datetime = getDateString()+" "+time;
-                mLogger.debug("datetime = "+datetime);
+                DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
+                Date newDate = df.parse(getDateString());
                 
-                // now parse pubtime in a timezone sensitive manner
-                SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
-                sdf.setTimeZone(timezone);
-                pubtime = sdf.parse(datetime);
-                entry.setPubTime(new Timestamp(pubtime.getTime()));
+                // Now handle the time from the hour, minute and second combos
+                if(newDate != null) {
+                    Calendar cal = Calendar.getInstance(locale);
+                    cal.setTime(newDate);
+                    cal.setTimeZone(timezone);
+                    cal.set(Calendar.HOUR_OF_DAY, getHours().intValue());
+                    cal.set(Calendar.MINUTE, getMinutes().intValue());
+                    cal.set(Calendar.SECOND, getSeconds().intValue());
+                    entry.setPubTime(new Timestamp(cal.getTimeInMillis()));
+                }
                 
             } catch(Exception e) {
                 mLogger.error(e);