Example usage for java.time ZoneId systemDefault

List of usage examples for java.time ZoneId systemDefault

Introduction

In this page you can find the example usage for java.time ZoneId systemDefault.

Prototype

public static ZoneId systemDefault() 

Source Link

Document

Gets the system default time-zone.

Usage

From source file:com.codepalousa.restlet.raml.DateTimeSerializeConverter.java

@Override
public String convert(Date value) {
    return LocalDateTime.ofInstant(value.toInstant(), ZoneId.systemDefault()).format(formatter);
}

From source file:eu.off.db.entity.MemberTest.java

@Test
public void BuildMinimalMember() {

    LocalDateTime dateTime = LocalDateTime.of(1978, Month.APRIL, 4, 0, 0);
    Date birthday = Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());

    Member aMember = new MemberBuilder(LAST_NAME, FIRST_NAME, STREET, ZIP_CODE, PLACE, COUNTRY, birthday,
            GENDER, NATIONALITY).build();

    assertThat(aMember.getLastName().equals(LAST_NAME));
    assertThat(aMember.getFirstName().equals(FIRST_NAME));
    assertThat(aMember.getAdress().equals(STREET));
    assertThat(aMember.getZipCode().equals(ZIP_CODE));
    assertThat(aMember.getPlace().equals(PLACE));
    assertThat(aMember.getCountry().equals(COUNTRY));
    assertThat(aMember.getBirthday().equals(birthday));
    assertThat(aMember.getGender().equals(GENDER));
    assertThat(aMember.getNationality().equals(NATIONALITY));
}

From source file:net.NET_INFO.java

/**
 * ? LocalDateTime/*from  ww  w . j a  v a 2 s  .  co m*/
 * @return the current date-time using the system clock and default time-zone.
 */
public static LocalDateTime getCurrentTime() {
    return LocalDateTime.ofInstant(Instant.ofEpochMilli(getCurrentMilli()), ZoneId.systemDefault());
}

From source file:pe.edu.system.jcmr.util.UtilidadesFx.java

public static LocalDate converterDateToLocalDate(Date date) {

    Instant instant = Instant.ofEpochMilli(date.getTime());
    LocalDate localDate = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()).toLocalDate();
    return localDate;
}

From source file:com.hengyi.japp.tools.DateTimeUtil.java

public static Date toDate(LocalDateTime localDateTime) {
    return localDateTime == null ? null : Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}

From source file:com.example.oauth.AccessToken.java

public AccessToken(final AccessTokenEntity accessToken) {
    this(accessToken.getAccessToken(), accessToken.getRefreshToken(), accessToken.getScopes(),
            OffsetDateTime.from(accessToken.getExpiration().toInstant().atZone(ZoneId.systemDefault())));
}

From source file:com.github.ibm.domino.resource.EventTime.java

public ZonedDateTime getEventDateTime() {

    String timeZone;/*from   ww w .ja v a  2 s  .c o  m*/
    if (isUtc()) {
        timeZone = "Z";
    } else {
        timeZone = "";
    }
    if (geteTime() == null) {
        return LocalDate.parse(geteDate()).atStartOfDay(ZoneId.systemDefault());
    } else {
        return ZonedDateTime.parse(geteDate() + "T" + geteTime() + timeZone);
    }
}

From source file:com.javiermoreno.springboot.mvc.users.UserManagementServiceImplIT.java

@Test
public void checkNewUserIsSavedAndContainsCorrectPasswordHash() {
    DailyUser user = new DailyUser();
    user.setEmail("alice@wonderland.com");
    user.setBirthday(// ww w .  j  av a2 s.c o m
            Date.from(LocalDate.of(1976, Month.DECEMBER, 12).atStartOfDay(ZoneId.systemDefault()).toInstant()));
    service.registerNewUser(user, "secret", true);

    Assert.assertNotSame("Id correctly assigned", 0, user.getId());
    Assert.assertEquals("Password md5 is correctely encoded.", "5ebe2294ecd0e0f08eab7690d2a6ee69",
            user.getPassword());
}

From source file:org.sakaiproject.component.app.scheduler.jobs.cm.processor.sis.AbstractCMProcessor.java

public Date getDate(String str) {
    if (StringUtils.isBlank(str)) {
        return null;
    }/*  w ww . j ava 2s. co m*/
    DateTimeFormatter df = DateTimeFormatter.ofPattern(dateFormat);
    try {
        return Date.from(LocalDate.parse(str, df).atStartOfDay(ZoneId.systemDefault()).toInstant());
    } catch (DateTimeParseException dtpe) {
        throw new RuntimeException("Cannot parse the date from: " + str, dtpe);
    }
}

From source file:io.curly.advisor.integration.event.CreatedReviewHandler.java

@Override
public void onApplicationEvent(CreatedReview event) {
    final Object source = event.getSource();

    if (log.isDebugEnabled()) {
        log.debug("Received application event with source {} at {}", source,
                LocalDateTime.ofInstant(Instant.ofEpochMilli(event.getTimestamp()), ZoneId.systemDefault()));
    }/*from w  w w. j a  va 2  s .c  o  m*/
    if (source instanceof Review) {
        final Review review = (Review) source;
        reviewEventEmitter.emmit(review);
    } else {
        log.warn("Application event source is not instance of review cannot emmit it!");
    }

}