From: john Date: Thu, 18 Apr 2002 08:54:10 +0000 (+0000) Subject: fixed the method which takes a webdb_date to a dublin core date to include X-Git-Tag: prexmlproducerconfig~106 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=3a0b52462aac3c8ef7ee467348853e3cc6bd254d;p=mir.git fixed the method which takes a webdb_date to a dublin core date to include correct timezone info --- diff --git a/source/mir/misc/StringUtil.java b/source/mir/misc/StringUtil.java index a65c7109..09f2a317 100755 --- a/source/mir/misc/StringUtil.java +++ b/source/mir/misc/StringUtil.java @@ -168,27 +168,27 @@ public final class StringUtil { /** * converts string from format: yyyy-mm-dd__hh:mm:ss.dddddd+TZ - * to yyyy-mm-ddThhmmss+TZ:00 (w3 format for Dublin Core) + * to yyyy-mm-ddThh:mm:ss+TZ:00 (w3 format for Dublin Core) */ public static String webdbdateToDCDate(String date) { StringBuffer returnDate = new StringBuffer(); if (date!=null) { - returnDate.append(date.substring(0,4)); - returnDate.append("-"); - returnDate.append(date.substring(5,7)); - returnDate.append("-"); - returnDate.append(date.substring(8,10)); + returnDate.append(date.substring(0,10)); returnDate.append("T"); - returnDate.append(date.substring(11,13)); - returnDate.append(":"); - returnDate.append(date.substring(14,16)); - returnDate.append(":"); - returnDate.append(date.substring(17,19)); - //removed until someone tells me - //where the timezone goes -john - //returnDate.append(date.substring(17,22)); - //returnDate.append(":00"); + returnDate.append(date.substring(11,19)); + String tzInfo=date.substring(26,29); + if (tzInfo.equals("+00")){ + //UTC gets a special code in w3 dates + returnDate.append("Z"); + } + else{ + //need to see what a newfoundland postgres + //timestamp looks like before making this robust + returnDate.append(tzInfo); + returnDate.append(":00"); + } + } return returnDate.toString(); }