Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Postgresql 9.5 Timestamp with time zone #240

Open
ZenLiuCN opened this issue Dec 22, 2017 · 2 comments
Open

Postgresql 9.5 Timestamp with time zone #240

ZenLiuCN opened this issue Dec 22, 2017 · 2 comments

Comments

@ZenLiuCN
Copy link

I'm using vertx 3.5.0 with postgresqlasync_2.12:0.2.21
insert into postgresql with Instant.now(),after then sometimes will got

java.lang.IllegalArgumentException: Invalid format: "2017-12-22 10:19:38+08" is malformed at "+08"
	at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)
	at com.github.mauricio.async.db.postgresql.column.PostgreSQLTimestampEncoderDecoder$.decode(PostgreSQLTimestampEncoderDecoder.scala:71)
	at com.github.mauricio.async.db.postgresql.column.PostgreSQLColumnDecoderRegistry.decode(PostgreSQLColumnDecoderRegistry.scala:52)
	at com.github.mauricio.async.db.postgresql.PostgreSQLConnection.onDataRow(PostgreSQLConnection.scala:203)
	at com.github.mauricio.async.db.postgresql.codec.PostgreSQLConnectionHandler.channelRead0(PostgreSQLConnectionHandler.scala:203)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)

i think it's because Instant.now() is with zone have zero millseconds(like 2017-01-01T00:00:00+8)
finally
i use

fun String.toPgTimeParse():String="to_char($this at time zone 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')"

to convert it before get from database

@manorsuperman
Copy link

I encountered this problem too.

@codepitbull
Copy link

I just provided a PR to fix this issue:
#255

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants