Java Code Examples for java.util.Date.toInstant()

The following are Jave code examples for showing how to use toInstant() of the java.util.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ProjectAres   File: TimeUtils.java   View Source Code Vote up 5 votes
public static Instant toInstant(Date date) {
    if(isInfFuture(date)) {
        return INF_FUTURE;
    } else if(isInfPast(date)) {
        return INF_PAST;
    } else {
        return date.toInstant();
    }
}
 
Example 2
Project: xm-ms-timeline   File: TimelineMapper.java   View Source Code Vote up 5 votes
private static Instant getInstant(Row row, String column) {
    if (row.getColumnDefinitions().contains(column)) {
        Date date = row.getTimestamp(column);
        return date != null ? date.toInstant() : null;
    }
    return null;
}
 
Example 3
Project: happylifeplat-transaction   File: DateUtils.java   View Source Code Vote up 4 votes
public static String parseDate(Date date) {
    Instant instant = date.toInstant();
    ZoneId zone = ZoneId.systemDefault();
    LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
    return formaterLocalDateTime(localDateTime);
}
 
Example 4
Project: gremlin-ogm   File: Primitives.java   View Source Code Vote up 4 votes
public static Instant toInstant(Date date) {
  return date.toInstant();
}
 
Example 5
Project: crnk-framework   File: DefaultDateTimeMapper.java   View Source Code Vote up 4 votes
@Override
public OffsetDateTime toOffsetDateTime(Date date) {
	Instant instant = date.toInstant();
	return OffsetDateTime.ofInstant(instant, ZoneId.systemDefault());
}
 
Example 6
Project: happylifeplat-tcc   File: DateUtils.java   View Source Code Vote up 4 votes
public static String parseDate(Date date) {
    Instant instant = date.toInstant();
    ZoneId zone = ZoneId.systemDefault();
    LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
    return formaterLocalDateTime(localDateTime);
}
 
Example 7
Project: myth   File: DateUtils.java   View Source Code Vote up 4 votes
public static String parseDate(Date date) {
    Instant instant = date.toInstant();
    ZoneId zone = ZoneId.systemDefault();
    LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
    return formaterLocalDateTime(localDateTime);
}
 
Example 8
Project: flow-platform   File: DateUtil.java   View Source Code Vote up 4 votes
public static ZonedDateTime fromDateForUTC(Date date) {
    Instant instant = date.toInstant();
    return instant.atZone(ZONE_UTC);
}
 
Example 9
Project: mid-tier   File: InstantConverter.java   View Source Code Vote up 4 votes
@Override
public Instant convertToEntityAttribute(Date dbData) {
    return dbData.toInstant();
}
 
Example 10
Project: bootstrap   File: AuditedBean.java   View Source Code Vote up 2 votes
/**
 * Null safe {@link Date} to {@link Instant} conversion.
 * 
 * @param date
 *            {@link Date} object.
 * @return {@link Instant} value or null.
 */
public static Instant toInstant(final Date date) {
	return date == null ? null : date.toInstant();
}