本文整理了Java中java.time.OffsetDateTime.toString()
方法的一些代码示例,展示了OffsetDateTime.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.toString()
方法的具体详情如下:
包路径:java.time.OffsetDateTime
类名称:OffsetDateTime
方法名:toString
[英]Outputs this date-time as a String, such as 2007-12-03T10:15:30+01:00.
The output will be one of the following ISO-8601 formats:
The format used will be the shortest that outputs the full value of the time where the omitted parts are implied to be zero.
[中]以字符串形式输出此日期时间,例如2007-12-03T10:15:30+01:00。
输出将是以下ISO-8601格式之一:
*yyyy MM dd'HH:mmXXXXX
*yyyy MM dd'HH:MM:ssXXXXX
*yyyy-MM-dd'HH:MM:ss。SSSxxx
*yyyy-MM-dd'HH:MM:ss。SSSSXXXXX
*yyyy-MM-dd'HH:MM:ss。SSSSXXXXX
所使用的格式将是最短的,输出省略部分暗示为零的时间的完整值。
代码示例来源:origin: kiegroup/jbpm
@Test(timeout=10000)
public void testTimerStartDateISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("StartProcess", 1);
byte[] content = IoUtils.readBytesFromInputStream(this.getClass().getResourceAsStream("/BPMN2-TimerStartDate.bpmn2"));
String processContent = new String(content, "UTF-8");
OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2);
processContent = processContent.replaceFirst("#\\{date\\}", plusTwoSeconds.toString());
Resource resource = ResourceFactory.newReaderResource(new StringReader(processContent));
resource.setSourcePath("/BPMN2-TimerStartDate.bpmn2");
resource.setTargetPath("/BPMN2-TimerStartDate.bpmn2");
KieBase kbase = createKnowledgeBaseFromResources(resource);
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(countDownListener);
final List<Long> list = new ArrayList<Long>();
ksession.addEventListener(new DefaultProcessEventListener() {
public void beforeProcessStarted(ProcessStartedEvent event) {
list.add(event.getProcessInstance().getId());
}
});
assertThat(list.size()).isEqualTo(0);
countDownListener.waitTillCompleted();
assertThat(list.size()).isEqualTo(1);
}
代码示例来源:origin: kiegroup/jbpm
@Test(timeout=10000)
public void testIntermediateCatchEventTimerDateISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 1);
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventTimerDateISO.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
ksession.addEventListener(countDownListener);
HashMap<String, Object> params = new HashMap<String, Object>();
OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2);
params.put("date", plusTwoSeconds.toString());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent", params);
assertProcessInstanceActive(processInstance);
// now wait for 1 second for timer to trigger
countDownListener.waitTillCompleted();
assertProcessInstanceFinished(processInstance, ksession);
}
代码示例来源:origin: kiegroup/jbpm
@Test(timeout=10000)
public void testTimerBoundaryEventDateISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("TimerEvent", 1);
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-TimerBoundaryEventDateISO.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler());
HashMap<String, Object> params = new HashMap<String, Object>();
OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2);
params.put("date", plusTwoSeconds.toString());
ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent", params);
assertProcessInstanceActive(processInstance);
countDownListener.waitTillCompleted();
ksession = restoreSession(ksession, true);
assertProcessInstanceFinished(processInstance, ksession);
}
代码示例来源:origin: neo4j/neo4j-ogm
@Override
public String toGraphProperty(OffsetDateTime value) {
if (value == null) {
return null;
}
return value.toString();
}
代码示例来源:origin: io.permazen/permazen-coreapi
@Override
public String toParseableString(OffsetDateTime offsetDateTime) {
return offsetDateTime.toString();
}
}
代码示例来源:origin: org.jsimpledb/jsimpledb-coreapi
@Override
public String toParseableString(OffsetDateTime offsetDateTime) {
return offsetDateTime.toString();
}
}
代码示例来源:origin: com.guestful.module/guestful.module.jsr310-extensions
/**
* Output a string in ISO8601 interval format.
* <p>
* From version 2.1, the string includes the time zone offset.
*
* @return re-parsable string (in the default zone)
*/
@Override
public String toString() {
return start.toOffsetDateTime().toString() + "/" + end.toOffsetDateTime().toString();
}
代码示例来源:origin: io.helixservice/helix-rest
private JsonObject heartBeatData() {
return new JsonObject()
.put(GIT_COMMIT_ID, commitId)
.put(GIT_REMOTE_URL, remoteUrl)
.put(APP_VERSION, appVersion)
.put(UP_SINCE, startedAt.toString())
.put(UP_TIME, currentUpTime());
}
代码示例来源:origin: rocks.xmpp/xmpp-extensions-common
/**
* Creates a header with a start date.
*
* @param dateTime The start date.
* @return The header.
* @see <a href="https://xmpp.org/extensions/xep-0149.html">XEP-0149: Time Periods</a>
*/
public static Header ofStartDate(OffsetDateTime dateTime) {
return new Header("Start", dateTime.toString());
}
代码示例来源:origin: org.openbase.bco/ontology.lib
/**
* Method returns the current dateTime.
*
* @return String in format yyyy-MM-dd'T'HH:mm:ss.SSSXXX
*/
public static String getCurrentDateTime() {
// final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(OntConfig.DATE_TIME, Locale.ENGLISH);
// final Date date = new Date();
return OffsetDateTime.now().toString();
}
代码示例来源:origin: ch.rasc/bsoncodec
@Override
public void encode(BsonWriter writer, OffsetDateTime value,
EncoderContext encoderContext) {
writer.writeString(value.toString());
}
代码示例来源:origin: rocks.xmpp/xmpp-extensions-common
@Override
public final String toString() {
OffsetDateTime dateTime = getDateTime();
if (dateTime != null) {
return dateTime.toString();
}
return super.toString();
}
}
代码示例来源:origin: stackoverflow.com
String dateTimestr = "2015-02-05T02:05:17.000+00:00";
OffsetDateTime dateTime = OffsetDateTime.parse(dateTimestr);
if ((dateTime.getNano() == 0) && (dateTimestr.length() > 25 ))
System.out.println(dateTime.toLocalDateTime() + ".000Z");
else
System.out.println(dateTime.toString());
代码示例来源:origin: Netflix/iceberg
@Override
public String read(String ignored) {
return ChronoUnit.MILLIS.addTo(EPOCH, column.nextLong()).toString();
}
}
代码示例来源:origin: Netflix/iceberg
@Override
public String read(String ignored) {
return ChronoUnit.MICROS.addTo(EPOCH, column.nextLong()).toString();
}
}
代码示例来源:origin: com.github.robozonky/robozonky-common
@Override
public Boolean call() {
final String sectionName = instanceState.getSectionName();
final StateStorage backend = instanceState.getStorage();
actions.forEach(a -> a.accept(backend, sectionName));
backend.setValue(sectionName, Constants.LAST_UPDATED_KEY.getValue(), DateUtil.offsetNow().toString());
return backend.store();
}
}
代码示例来源:origin: org.openbase.bco/ontology.lib
private void deleteObservations() throws CouldNotPerformException, InterruptedException {
//TODO
final String dateTimeFrom = StringModifier.convertToLiteral(OffsetDateTime.of(2017, 4, 19, 0, 0, 0, 0, ZoneOffset.UTC).toString(), XsdType.DATE_TIME);
final String dateTimeUntil = StringModifier.convertToLiteral(OffsetDateTime.of(2017, 4, 20, 0, 0, 0, 0, ZoneOffset.UTC).toString(), XsdType.DATE_TIME);
SparqlHttp.uploadSparqlRequest(QueryExpression.deleteObservationOfTimeFrame(dateTimeFrom, dateTimeUntil), OntConfig.getOntologyDbUrl(), 0);
}
}
代码示例来源:origin: org.pageseeder.bridge/pso-bridge
@Override
public void toXML(XMLWriter xml) throws IOException {
xml.openElement("modifiedby");
xml.attribute("date", this._date.toString()); // TODO date formatting
this._member.toXMLAttributes(xml);
xml.closeElement();
}
代码示例来源:origin: com.github.robozonky/robozonky-notifications
public void setDelinquent(final SessionInfo sessionInfo, final Investment investment) {
if (this.isDelinquent(sessionInfo, investment)) {
return;
}
TenantState.of(sessionInfo)
.in(DelinquencyTracker.class)
.update(b -> b.put(toId(investment), DateUtil.offsetNow().toString()));
}
代码示例来源:origin: org.pageseeder.bridge/pso-bridge
@Override
public void toXML(XMLWriter xml) throws IOException {
xml.openElement("assignedto");
xml.attribute("date", this._date.toString()); // TODO date formatting
this._member.toXMLAttributes(xml);
xml.element("fullname", this._member.getFirstname()+" "+this._member.getSurname());
xml.closeElement();
}
内容来源于网络,如有侵权,请联系作者删除!