Package org.threeten.bp

Examples of org.threeten.bp.LocalDateTime


    }

    @Test
    public void test_LocalDateTime_adjustToJapaneseDate() {
        ChronoLocalDate jdate = JapaneseChronology.INSTANCE.date(1890, 10, 29);
        LocalDateTime test = LocalDateTime.MIN.with(jdate);
        assertEquals(test, LocalDateTime.of(1890, 10, 29, 0, 0));
    }
View Full Code Here


    }

    @Test
    public void test_LocalDateTime_adjustToBuddhistDate() {
        ChronoLocalDate jdate = ThaiBuddhistChronology.INSTANCE.date(2555, 10, 29);
        LocalDateTime test = LocalDateTime.MIN.with(jdate);
        assertEquals(test, LocalDateTime.of(2012, 10, 29, 0, 0));
    }
View Full Code Here

    //-----------------------------------------------------------------------
    // Test Serialization of ISO via chrono API
    //-----------------------------------------------------------------------
    @Test( dataProvider="calendars")
    public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception {
        LocalDateTime ref = LocalDate.of(2000, 1, 5).atTime(12, 1, 2, 3);
        ChronoLocalDateTime<?> orginal = chrono.date(ref).atTime(ref.toLocalTime());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(baos);
        out.writeObject(orginal);
        out.close();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
View Full Code Here

   
  }

  @Override
  public void start() {
    LocalDateTime now = LocalDateTime.now();
    LocalDateTime nextHour = now.truncatedTo(HOURS).plusHours(1);
    Duration delay = Duration.between(now.atOffset(ZoneOffset.UTC), nextHour.atOffset(ZoneOffset.UTC));
    Duration oneHour = Duration.ofHours(1);
    s_logger.warn("Now {} Next {} Delay {} {}", new Object[] {now, nextHour, delay, delay.toMillis() });
    _timerExecutor.scheduleAtFixedRate(new SnapshotTask(), delay.toMillis(), oneHour.toMillis(), TimeUnit.MILLISECONDS);
    if (getInitializationFileName() != null) {
      initializeFromFile(getInitializationFileName());
View Full Code Here

    if (result.getValuationTime() != null) {
      valuationTime = result.getValuationTime();
    } else {
      valuationTime = OpenGammaClock.getInstance().instant();
    }
    LocalDateTime time = LocalDateTime.ofInstant(valuationTime, OpenGammaClock.getZone());

    String filename = String.format("%s-%s-%s.csv",
                                    view.getViewDefinitionId(),
                                    gridType.name().toLowerCase(),
                                    time.toString(CSV_TIME_FORMAT));
    response.addHeader("content-disposition", "attachment; filename=\"" + filename + "\"");
    return view.getAllGridData(gridType, TypeFormatter.Format.CELL);
  }
View Full Code Here

  public ViewportResults getViewportResultAsCsv(@Context HttpServletResponse response) {
    ArgumentChecker.notNull(response, "response");
   
    ViewportResults result = getView().getAllGridData(getGridType(), Format.CELL);
    Instant valuationTime = result.getValuationTime() == null ? OpenGammaClock.getInstance().instant() : result.getValuationTime();
    LocalDateTime time = LocalDateTime.ofInstant(valuationTime, OpenGammaClock.getZone());
   
    String filename = String.format("%s-%s-%s.csv", getView().getViewDefinitionId(), getGridType().name().toLowerCase(), time.toString(CSV_TIME_FORMAT));
    response.addHeader("content-disposition", "attachment; filename=\"" + filename + "\"");
    return getView().getAllGridData(getGridType(), Format.CELL);
  }
View Full Code Here

   *
   * @param timestamp  the SQL time-stamp to convert, not null
   * @return the instant, null if far-future
   */
  public static Instant fromSqlTimestamp(Timestamp timestamp) {
    LocalDateTime ldt = fromSqlDateTime(timestamp);
    return ldt.atOffset(ZoneOffset.UTC).toInstant();
  }
View Full Code Here

TOP

Related Classes of org.threeten.bp.LocalDateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.