Java Code Examples for org.threeten.bp.Instant#toEpochMilli()

The following examples show how to use org.threeten.bp.Instant#toEpochMilli() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogUtil.java    From Hentoid with Apache License 2.0 6 votes vote down vote up
private static String buildLog(@Nonnull LogInfo info) {
    StringBuilder logStr = new StringBuilder();
    logStr.append(info.logName).append(" log : begin").append(LINE_SEPARATOR);
    logStr.append(String.format("Hentoid ver: %s (%s)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)).append(LINE_SEPARATOR);
    if (info.log.isEmpty())
        logStr.append("No activity to report - ").append(info.noDataMessage).append(LINE_SEPARATOR);
    else {
        // Log beginning, end and duration
        Instant beginning = Stream.of(info.log).filter(l -> l.timestamp != null).min((a, b) -> a.timestamp.compareTo(b.timestamp)).get().timestamp;
        Instant end = Stream.of(info.log).filter(l -> l.timestamp != null).max((a, b) -> a.timestamp.compareTo(b.timestamp)).get().timestamp;
        long durationMs = end.toEpochMilli() - beginning.toEpochMilli();
        logStr.append("Start : ").append(beginning.toString()).append(LINE_SEPARATOR);
        logStr.append("End : ").append(end.toString()).append(" (").append(durationMs / 1000).append(" s)").append(LINE_SEPARATOR);
        logStr.append("-----").append(LINE_SEPARATOR);

        // Log header and entries
        if (!info.header.isEmpty()) logStr.append(info.header).append(LINE_SEPARATOR);
        for (LogEntry entry : info.log)
            logStr.append(entry.message).append(LINE_SEPARATOR);
    }

    logStr.append(info.logName).append(" log : end");

    return logStr.toString();
}
 
Example 2
Source File: Prepayment.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDate(LocalDate date) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  date.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.date = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 3
Source File: Quote.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setExpiryDate(LocalDate expiryDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  expiryDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.expiryDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 4
Source File: BankTransfer.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDate(LocalDate date) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  date.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.date = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 5
Source File: BankTransaction.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDate(LocalDate date) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  date.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.date = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 6
Source File: PurchaseOrder.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDeliveryDate(LocalDate deliveryDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  deliveryDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.deliveryDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 7
Source File: PayrollCalendar.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setStartDate(LocalDate startDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  startDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.startDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 8
Source File: PurchaseOrder.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDate(LocalDate date) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  date.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.date = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 9
Source File: Invoice.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDueDate(LocalDate dueDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  dueDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.dueDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 10
Source File: Employee.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDateOfBirth(LocalDate dateOfBirth) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  dateOfBirth.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.dateOfBirth = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 11
Source File: LeaveApplication.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setStartDate(LocalDate startDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  startDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.startDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 12
Source File: LeavePeriod.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setPayPeriodEndDate(LocalDate payPeriodEndDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  payPeriodEndDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.payPeriodEndDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 13
Source File: Timesheet.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setEndDate(LocalDate endDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  endDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.endDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 14
Source File: Overpayment.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setDate(LocalDate date) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  date.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.date = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 15
Source File: Organisation.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setPeriodLockDate(LocalDate periodLockDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  periodLockDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.periodLockDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 16
Source File: Organisation.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setEndOfYearLockDate(LocalDate endOfYearLockDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  endOfYearLockDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.endOfYearLockDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 17
Source File: PayRun.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setPaymentDate(LocalDate paymentDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  paymentDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.paymentDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 18
Source File: PayRun.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setPayRunPeriodEndDate(LocalDate payRunPeriodEndDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  payRunPeriodEndDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.payRunPeriodEndDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 19
Source File: PayRun.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setPayRunPeriodStartDate(LocalDate payRunPeriodStartDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  payRunPeriodStartDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.payRunPeriodStartDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}
 
Example 20
Source File: LeaveApplication.java    From Xero-Java with MIT License 5 votes vote down vote up
public void setEndDate(LocalDate endDate) {
  //CONVERT LocalDate args into MS DateFromat String
  Instant instant =  endDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant();  
  long timeInMillis = instant.toEpochMilli();

  this.endDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/";
}