Hi all,

I've corrected the issue.

As Bram mentioned, dates are stored in UTC. When you display an item's full 
record, ItemTag.java simply pulls the data from the database and displays 
it—with no care as to what type of data the string contains. I added a few 
lines of code to check if the field represented a date field and then called 
the appropriate method in UIUtil.java:

    if(values[i].element.equals("date") && 
(values[i].qualifier.equals("accessioned") || 
values[i].qualifier.equals("available") ||
                                                                                
                values[i].qualifier.equals("updated")))
     {
        DCDate dt = new DCDate(values[i].value) ;
        String str = UIUtil.displayDate(dt, true, true, 
(HttpServletRequest)pageContext.getRequest()) ;
        out.print(Utils.addEntities(str)) ;
     }
    else out.print(Utils.addEntities(values[i].value));

(The highlighted portion is the original code.)


Darren Arsenault
Programmer
Algonquin College
1385 Woodroffe Avenue
Ottawa, ON, K2G 1V8

________________________________
From: bluy...@gmail.com [bluy...@gmail.com] On Behalf Of Bram Luyten 
[b...@mire.be]
Sent: September-27-12 3:19 AM
To: Darren Arsenault
Cc: dspace-tech@lists.sourceforge.net
Subject: Re: [Dspace-tech] incorrect timestamps in DSpace

Hi Darren,

at first sight, this looks like a UI specific problem:

In the back-end, dates are just stored as UTC:
https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/content/DCDate.java#L44

JSP UI seems to have a util class that renders the dates according to the 
user's locale:
https://github.com/DSpace/DSpace/blob/master/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/util/UIUtil.java#L247

In XMLUI however, the dates seem to be retrieved from the metadata without 
transformation into something local.

Mirage & other dri2xhtml alt based themes:
https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/themes/dri2xhtml-alt/aspect/artifactbrowser/item-view.xsl#L286

Kubrick, Classic, Reference themes:
https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/themes/dri2xhtml/DIM-Handler.xsl#L621

best regards,

Bram

--
[http://atmire.com/images/@mire_web_2.jpg]
        Bram Luyten @mire
2888 Loker Avenue East, Suite 315, Carlsbad, CA. 92010
Esperantolaan 4, Heverlee 3001, Belgium
 <http://www.atmire.com/> 
www.atmire.com<http://atmire.com/website/?q=services&utm_source=emailfooter&utm_medium=email&utm_campaign=braml>



On Wed, Sep 26, 2012 at 6:16 PM, Darren Arsenault 
<arse...@algonquincollege.com<mailto:arse...@algonquincollege.com>> wrote:
Hi all,

I have just noticed that the timestamps in DSpace are all off by +4 hours. The 
timezone must be set to GMT (I am GMT -4), but I cannot find where to correct 
this. Can anyone point me in the right direction please?

Darren Arsenault
Programmer
Algonquin College
1385 Woodroffe Avenue
Ottawa, ON, K2G 1V8

------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net<mailto:DSpace-tech@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/dspace-tech


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to