Example usage for java.time LocalDateTime parse

List of usage examples for java.time LocalDateTime parse

Introduction

In this page you can find the example usage for java.time LocalDateTime parse.

Prototype

public static LocalDateTime parse(CharSequence text) 

Source Link

Document

Obtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30 .

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.parse("2014-06-30T12:01:00");

    System.out.println(a);
}

From source file:ca.qhrtech.utilities.LocalDateTimeDeserializer.java

@Override
public LocalDateTime deserialize(JsonParser jp, DeserializationContext dc)
        throws IOException, JsonProcessingException {
    return LocalDateTime.parse(jp.getText());
}

From source file:ch.rasc.edsutil.jackson.ISO8601LocalDateTimeDeserializer.java

@Override
public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    return LocalDateTime.parse(jp.getText());
}

From source file:sample.formatter.LocalDateTimeFormatter.java

@Override
public LocalDateTime parse(String text, Locale locale) throws ParseException {
    return LocalDateTime.parse(text);
}

From source file:org.cyclop.model.adapter.LocalDateTimeAdapter.java

@Override
public LocalDateTime unmarshal(String val) throws Exception {
    val = StringUtils.trimToNull(val);
    if (val == null) {
        return null;
    }/*w  ww. ja v  a 2  s  .c  o m*/
    return LocalDateTime.parse(val);
}

From source file:ch.rasc.wampspring.demo.various.scheduler.LocalDateTimeDeserializer.java

@Override
public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    if (jp.getText().contains("+") || jp.getText().endsWith("Z")) {
        return ZonedDateTime.parse(jp.getText()).toLocalDateTime();
    }//from   w ww  .j  av  a2  s  . com
    return LocalDateTime.parse(jp.getText());
}

From source file:net.jmhertlein.mcanalytics.api.request.PastOnlinePlayerCountRequest.java

@Override
public LinkedHashMap<LocalDateTime, Integer> processResponse(JSONObject response) {
    JSONObject counts = response.getJSONObject("counts");
    LinkedHashMap<LocalDateTime, Integer> ret = new LinkedHashMap<>();

    for (String s : counts.keySet()) {
        ret.put(LocalDateTime.parse(s), counts.getInt(s));
    }/* w  ww .ja v  a 2 s . co m*/

    return ret;
}

From source file:svc.data.citations.datasources.tyler.transformers.CitationTransformer.java

private LocalDateTime parseViolationCourtDate(String violationCourtDateString) {

    if (violationCourtDateString == null) {
        return null;
    }/*  www  . j  a v  a2  s .co m*/

    LocalDateTime violationCourtDate = null;
    try {
        violationCourtDate = LocalDateTime.parse(violationCourtDateString);
    } catch (DateTimeParseException ex) {
        LogSystem.LogEvent("Failed to parse tyler violation court date: " + ex.getLocalizedMessage());
    }
    return violationCourtDate;
}

From source file:net.resheim.eclipse.timekeeper.internal.TaskActivationListener.java

@Override
public void preTaskActivated(ITask task) {
    LocalDateTime now = LocalDateTime.now();
    String startString = Activator.getValue(task, Activator.START);
    String tickString = Activator.getValue(task, Activator.TICK);
    if (startString != null) {
        LocalDateTime ticked = LocalDateTime.parse(tickString);
        LocalDateTime stopped = LocalDateTime.now();
        long seconds = ticked.until(stopped, ChronoUnit.SECONDS);
        String time = DurationFormatUtils.formatDuration(seconds * 1000, "H:mm", true);
        boolean confirm = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Add elapsed time?",
                "Work was already started and task was last updated on "
                        + ticked.format(DateTimeFormatter.ofPattern("EEE e, HH:mm", Locale.US))
                        + ". Continue and add the elapsed time since (" + time + ") to the task total?");
        if (confirm) {
            Activator.accumulateTime(task, startString, ticked.until(LocalDateTime.now(), ChronoUnit.MILLIS));
        }//from w  w w  . j  a  v a2 s  .c o m
    }
    Activator.setValue(task, Activator.TICK, now.toString());
    Activator.setValue(task, Activator.START, now.toString());
}

From source file:net.jmhertlein.mcanalytics.api.request.NewPlayerLoginsRequest.java

@Override
public LinkedHashMap<LocalDateTime, Integer> processResponse(JSONObject response) {
    JSONObject counts = response.getJSONObject("first_login_counts");
    LinkedHashMap<LocalDateTime, Integer> ret = new LinkedHashMap<>();

    for (String s : counts.keySet()) {
        ret.put(LocalDateTime.parse(s), counts.getInt(s));
    }//from  w  w w. j  av a2s .c om

    return ret;
}