Example usage for java.time.format DateTimeFormatter ISO_DATE_TIME

List of usage examples for java.time.format DateTimeFormatter ISO_DATE_TIME

Introduction

In this page you can find the example usage for java.time.format DateTimeFormatter ISO_DATE_TIME.

Prototype

DateTimeFormatter ISO_DATE_TIME

To view the source code for java.time.format DateTimeFormatter ISO_DATE_TIME.

Click Source Link

Document

The ISO-like date-time formatter that formats or parses a date-time with the offset and zone if available, such as '2011-12-03T10:15:30', '2011-12-03T10:15:30+01:00' or '2011-12-03T10:15:30+01:00[Europe/Paris]'.

Usage

From source file:de.speexx.jira.jan.command.issuequery.CsvCreator.java

String localDateTimeToString(final LocalDateTime dt) {
    assert dt != null;
    return DateTimeFormatter.ISO_DATE_TIME.format(dt);
}

From source file:com.github.ibm.domino.client.BaseClient.java

protected String getDateParameter(ZonedDateTime value) {
    StringBuilder sValue = new StringBuilder(value.format(DateTimeFormatter.ISO_DATE_TIME));
    int i = sValue.indexOf(GMT_STRING);
    if (i >= 0) {
        sValue.delete(i, i + GMT_STRING.length());
    }/*from  ww w  .j  a va  2s  .co  m*/
    i = sValue.indexOf(PERIOD);
    if (i >= 0) {
        sValue.delete(i, i + 4);
    }
    return sValue.toString();
}

From source file:com.nirmata.workflow.details.JsonSerializer.java

public static RunnableTask getRunnableTask(JsonNode node) {
    List<RunnableTaskDag> taskDags = Lists.newArrayList();
    node.get("taskDags").forEach(n -> taskDags.add(getRunnableTaskDag(n)));

    Map<TaskId, ExecutableTask> tasks = Maps.newHashMap();
    Iterator<Map.Entry<String, JsonNode>> fields = node.get("tasks").fields();
    while (fields.hasNext()) {
        Map.Entry<String, JsonNode> next = fields.next();
        tasks.put(new TaskId(next.getKey()), getExecutableTask(next.getValue()));
    }/*from  w w w.ja v a2  s .  c o m*/

    LocalDateTime startTime = LocalDateTime.parse(node.get("startTimeUtc").asText(),
            DateTimeFormatter.ISO_DATE_TIME);
    LocalDateTime completionTime = node.get("completionTimeUtc").isNull() ? null
            : LocalDateTime.parse(node.get("completionTimeUtc").asText(), DateTimeFormatter.ISO_DATE_TIME);
    RunId parentRunId = node.get("parentRunId").isNull() ? null : new RunId(node.get("parentRunId").asText());
    return new RunnableTask(tasks, taskDags, startTime, completionTime, parentRunId);
}

From source file:it.tidalwave.northernwind.frontend.ui.component.sitemap.DefaultSitemapViewController.java

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Nonnull/*from ww w.  j av  a 2 s . c  o m*/
private ZonedDateTime getSiteNodeDateTime(final @Nonnull ResourceProperties properties) {
    try {
        final String string = properties.getProperty(Properties.PROPERTY_LATEST_MODIFICATION_DATE);
        return ZonedDateTime.parse(string, DateTimeFormatter.ISO_DATE_TIME);
    } catch (NotFoundException e) {
    } catch (IOException e) {
        log.warn("", e);
    }

    return Instant.ofEpochMilli(0).atZone(ZoneId.of("GMT"));
}

From source file:com.fanniemae.ezpie.common.StringUtilities.java

public static LocalDateTime toDateTime(String s, LocalDateTime defaultValue) {
    if (StringUtilities.isNullOrEmpty(s))
        return defaultValue;

    try {//from w w  w  . jav  a  2s  .com
        DateTimeFormatter fmt = DateTimeFormatter.ISO_DATE_TIME;
        return LocalDateTime.parse(s, fmt);
    } catch (Exception ex) {
        ExceptionUtilities.goSilent(ex);
        return defaultValue;
    }
}

From source file:com.nirmata.workflow.details.JsonSerializer.java

public static JsonNode newTaskExecutionResult(TaskExecutionResult taskExecutionResult) {
    ObjectNode node = newNode();//w w  w.  j a va 2 s  . c o  m
    node.put("status", taskExecutionResult.getStatus().name().toLowerCase());
    node.put("message", taskExecutionResult.getMessage());
    node.putPOJO("resultData", taskExecutionResult.getResultData());
    node.put("subTaskRunId",
            taskExecutionResult.getSubTaskRunId().isPresent()
                    ? taskExecutionResult.getSubTaskRunId().get().getId()
                    : null);
    node.put("completionTimeUtc",
            taskExecutionResult.getCompletionTimeUtc().format(DateTimeFormatter.ISO_DATE_TIME));
    return node;
}

From source file:com.nirmata.workflow.details.JsonSerializer.java

public static TaskExecutionResult getTaskExecutionResult(JsonNode node) {
    JsonNode subTaskRunIdNode = node.get("subTaskRunId");
    return new TaskExecutionResult(TaskExecutionStatus.valueOf(node.get("status").asText().toUpperCase()),
            node.get("message").asText(), getMap(node.get("resultData")),
            ((subTaskRunIdNode != null) && !subTaskRunIdNode.isNull()) ? new RunId(subTaskRunIdNode.asText())
                    : null,/*  ww w. ja va 2 s .  c o  m*/
            LocalDateTime.parse(node.get("completionTimeUtc").asText(), DateTimeFormatter.ISO_DATE_TIME));
}

From source file:com.nirmata.workflow.details.JsonSerializer.java

public static JsonNode newStartedTask(StartedTask startedTask) {
    ObjectNode node = newNode();/*from w w  w  .  ja va2  s. co m*/
    node.put("instanceName", startedTask.getInstanceName());
    node.put("startDateUtc", startedTask.getStartDateUtc().format(DateTimeFormatter.ISO_DATE_TIME));
    return node;
}

From source file:com.nirmata.workflow.details.JsonSerializer.java

public static StartedTask getStartedTask(JsonNode node) {
    return new StartedTask(node.get("instanceName").asText(),
            LocalDateTime.parse(node.get("startDateUtc").asText(), DateTimeFormatter.ISO_DATE_TIME));
}

From source file:org.talend.dataquality.statistics.datetime.utils.PatternListGenerator.java

@SuppressWarnings("unused")
private static void validateISOPattens(List<String> isoPatternList) {

    Set<String> formattedDateTimeSet = new HashSet<String>();
    for (String pattern : isoPatternList) {
        formattedDateTimeSet.add(getFormattedDateTime(pattern, Locale.US));
    }//from  ww w . jav a 2 s.  c o m

    DateTimeFormatter[] formatters = new DateTimeFormatter[] { DateTimeFormatter.BASIC_ISO_DATE, // 1
            DateTimeFormatter.ISO_DATE, // 2
            DateTimeFormatter.ISO_DATE_TIME, // 3
            // DateTimeFormatter.ISO_TIME, //
            DateTimeFormatter.ISO_INSTANT, // 4
            DateTimeFormatter.ISO_LOCAL_DATE, // 5
            DateTimeFormatter.ISO_LOCAL_DATE_TIME, // 6
            // DateTimeFormatter.ISO_LOCAL_TIME, //
            DateTimeFormatter.ISO_OFFSET_DATE, // 7
            DateTimeFormatter.ISO_OFFSET_DATE_TIME, // 8
            // DateTimeFormatter.ISO_OFFSET_TIME, //
            DateTimeFormatter.ISO_ORDINAL_DATE, // 9
            DateTimeFormatter.ISO_WEEK_DATE, // 10
            DateTimeFormatter.ISO_ZONED_DATE_TIME, // 11
            DateTimeFormatter.RFC_1123_DATE_TIME, // 12
    };

    System.out.println("-------------Validate ISO PattenText-------------");
    for (int i = 0; i < formatters.length; i++) {

        System.out.print((i + 1) + "\t");
        try {
            String formattedDateTime = ZONED_DATE_TIME.format(formatters[i]);
            System.out.print(formattedDateTimeSet.contains(formattedDateTime) ? "YES\t" : "NO\t");
            System.out.println(formattedDateTime);
        } catch (Throwable t) {
            System.out.println(t.getMessage());
        }
    }

}