• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5668

Show
Ignore:
Timestamp:
10/09/08 12:43:21 (6 weeks ago)
Author:
will
Message:

Fixed Date-Time printing of "n days". 3.1.2

Files:
1 modified

  • branches/ProtocolEditor/src/util/DefaultExport.java (modified) (2 diffs)

Legend:

Unmodified
Added
Removed
  • branches/ProtocolEditor/src/util/DefaultExport.java

    r5665 r5668  
    3434import java.text.SimpleDateFormat; 
    3535import java.util.ArrayList; 
     36import java.util.Calendar; 
     37import java.util.GregorianCalendar; 
    3638import java.util.HashMap; 
    3739import java.util.Iterator; 
    … …  
    301303                String UTCmillisecs = dataField.getAttribute(DataFieldConstants.UTC_MILLISECS); 
    302304                        if (UTCmillisecs != null) { 
    303                                 SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy"); 
    304                                 date = date + sdf.format(new Long(UTCmillisecs)); 
     305                                Calendar cal = new GregorianCalendar(); 
     306                                cal.setTimeInMillis(new Long(UTCmillisecs)); 
     307                                if (cal.get(Calendar.YEAR) == 1970) { 
     308                                        int days = cal.get(Calendar.DAY_OF_MONTH) - 1; // 1st of month is 0 days 
     309                                        date = date + days + " Days."; 
     310                                } else { 
     311                                        SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy"); 
     312                                        date = date + sdf.format(cal.getTimeInMillis()); 
     313                                } 
    305314                        } else { 
    306315                                date = date + "none set."; 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/