Skip to content

Commit

Permalink
feat: format export datetime data
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron3S committed Jan 2, 2025
1 parent 475ad14 commit 9492e34
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import java.io.IOException;
import java.nio.file.Files;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -165,7 +167,13 @@ public void export(String scope) throws SQLException {
writer.write("NULL");
writer.write(",");
} else {
writeString(writer, row.get(field.getName()));
var obj = row.get(field.getName());
if (obj instanceof Date) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
writeString(writer, fmt.format(obj));
} else {
writeString(writer, obj);
}
writer.write(",");
}
}
Expand Down

0 comments on commit 9492e34

Please sign in to comment.