Example usage for org.joda.time DateTimeZone getMillisKeepLocal

List of usage examples for org.joda.time DateTimeZone getMillisKeepLocal

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone getMillisKeepLocal.

Prototype

public long getMillisKeepLocal(DateTimeZone newZone, long oldInstant) 

Source Link

Document

Gets the millisecond instant in another zone keeping the same local time.

Usage

From source file:com.facebook.presto.testing.MaterializedResult.java

License:Apache License

private static MaterializedRow toTimeZone(MaterializedRow prestoRow, DateTimeZone oldTimeZone,
        DateTimeZone newTimeZone) {/*from w ww .  java  2 s . c  om*/
    List<Object> values = new ArrayList<>();
    for (int field = 0; field < prestoRow.getFieldCount(); field++) {
        Object value = prestoRow.getField(field);
        if (value instanceof Date) {
            long oldMillis = ((Date) value).getTime();
            long newMillis = oldTimeZone.getMillisKeepLocal(newTimeZone, oldMillis);
            value = new Date(newMillis);
        }
        values.add(value);
    }
    return new MaterializedRow(prestoRow.getPrecision(), values);
}