Skip to content

Commit 7ea36ba

Browse files
committed
Fixed OAI date_until to figshare modified_before date conversion, all now done in UTC.
1 parent 3b9af85 commit 7ea36ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/net/datanoid/oaipmh/figshare/FigshareOAICatalog.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.text.SimpleDateFormat;
5151
import java.util.Calendar;
5252
import java.util.GregorianCalendar;
53+
import java.util.TimeZone;
5354
import java.util.UUID;
5455
import java.util.logging.Level;
5556
import java.util.logging.Logger;
@@ -132,11 +133,15 @@ private String convertToFigshareQueryDate(String indate, boolean until) throws B
132133
String finedate = toFinestUntil(indate);
133134
LOG.log(Level.FINER, "convertToFigshareQueryDate() finedate="+finedate);
134135
SimpleDateFormat strFormatOut1 = new SimpleDateFormat("dd/MM/yyyy");
136+
strFormatOut1.setTimeZone(TimeZone.getTimeZone("UTC"));
135137
SimpleDateFormat strFormatOut2 = new SimpleDateFormat("dd/MM/yyyy'T'HH:mm:ss'Z'");
138+
strFormatOut2.setTimeZone(TimeZone.getTimeZone("UTC"));
136139
String formatIn1 = "yyyy-MM-dd";
137-
String formatIn2 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
140+
String formatIn2 = "yyyy-MM-dd'T'HH:mm:ssX";
138141
SimpleDateFormat strFormatIn1 = new SimpleDateFormat(formatIn1);
142+
strFormatIn1.setTimeZone(TimeZone.getTimeZone("UTC"));
139143
SimpleDateFormat strFormatIn2 = new SimpleDateFormat(formatIn2);
144+
strFormatIn1.setTimeZone(TimeZone.getTimeZone("UTC"));
140145
// Fix OAICAT setting the year to 9999, as figshare needs 2999
141146
if ( finedate.startsWith("9999") ) {
142147
finedate = "2999"+finedate.substring(4);

0 commit comments

Comments
 (0)