Sha256: b335022e2e734aea782c2164fb758366770065a893309dd9be8eb8ed33041ec0
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 Bytes
Contents
package org.embulk.output.oracle; import java.sql.Timestamp; import java.text.FieldPosition; import java.text.SimpleDateFormat; import java.util.Date; public class TimestampFormat extends SimpleDateFormat { private final int scale; public TimestampFormat(String pattern, int scale) { super(pattern); this.scale = scale; } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) { StringBuffer buffer = super.format(date, toAppendTo, pos); if (scale > 0) { buffer.append('.'); String nanos = Integer.toString(((Timestamp)date).getNanos()); int zeros = Math.min(scale, 9 - nanos.length()); for (int i = 0; i < zeros; i++) { buffer.append('0'); } buffer.append(nanos.substring(0, scale - zeros)); } return buffer; } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
embulk-output-oracle-0.4.1 | src/main/java/org/embulk/output/oracle/TimestampFormat.java |
embulk-output-oracle-0.2.4 | src/main/java/org/embulk/output/oracle/TimestampFormat.java |