我有这样的XMLGregorianCalendar日期'2016-09-27T10:49:27.640 + 03:00' 需要获得没有时区偏移的时间戳 我这样做:
XMLGregorianCalendar gcWorkDate = request.getWorkDate();
//gcWorkDate = (com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl) 2016-09-27T10:49:27.640+03:00
gcWorkDate.setTimezone(0);
//gcWorkDate = (com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl) 2016-09-27T10:49:27.640Z
Timestamp tsWorkDate = new Timestamp(gcWorkDate.toGregorianCalendar().getTimeInMillis());
//tsWorkDate = (java.sql.Timestamp) 2016-09-27 13:49:27.64
我想收到tsWorkDate = 2016-09-27 10:49:27.64 我做错了什么?
答案 0 :(得分:1)
这样做。
PREFIX d2r: <http://sites.wiwiss.fu-berlin.de/suhl/bizer/d2r-server/config.rdf#>
PREFIX v: <http://www.vocab.com/resource/vocab/>
SELECT ?hour ((?latest - ?earliest) as ?value) {
{
SELECT ?hour (MIN(?value) as ?earliest) WHERE {
?s v:time ?time;
v:value ?value
}
GROUP BY (HOURS(?time) as ?hour)
}
{ SELECT ?hour (MAX(?value) as ?latest) WHERE {
?s v:time ?time;
v:value ?value
}
GROUP BY (HOURS(?time) as ?hour)
}
FILTER (?hour>= timeFrom && ?hour <= timeTo)
}
ORDER BY ?hour