Fetch datetime (timestampsz) into local timezone using jooq api. Is there any way to use AT TIME ZONE in postgres.

22 views
Skip to first unread message

ompraka...@xymob.com

unread,
Jun 26, 2018, 1:54:29 AM6/26/18
to jOOQ User Group

Getting some issues with org.jooq api. Saving data into DB, in UTC format for timestamptz fields. When fetching the same from db, there is a way in postgres. 

select id, created_datetime at time zone 'pst' from account. 

Is there any way to achieve the same into jooq ?


selectStep = selectStep.select(fieldName).as(aliasName))

Lukas Eder

unread,
Jun 26, 2018, 5:43:04 AM6/26/18
to jooq...@googlegroups.com
Hello,
Thanks for your message. As you've noticed also on your cross-posted Stack Overflow question...

... this syntax is not yet supported out of the box by jOOQ. The relevant feature request is:

You can always work around missing functionality by using plain SQL templating:

I hope this helps,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Omprakash Verma

unread,
Jun 26, 2018, 6:05:20 AM6/26/18
to jooq...@googlegroups.com
Thank you for your reply. Can you please guide me how to change datetime in localtimezone while fetching the records from the postgres.

selectStep = selectStep.select(fieldName).as(aliasName))


Is there any way to create sql query like "Select id, created_at at time zone 'pst' from account

Thanks,
Om

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/1PGtTt8JRTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.

Lukas Eder

unread,
Jun 26, 2018, 6:08:49 AM6/26/18
to jooq...@googlegroups.com
Yes, use plain SQL templating as I mentioned in the previous message:


Am Di., 26. Juni 2018 um 12:05 Uhr schrieb Omprakash Verma <ompraka...@xymob.com>:
Thank you for your reply. Can you please guide me how to change datetime in localtimezone while fetching the records from the postgres.

selectStep = selectStep.select(fieldName).as(aliasName))


Is there any way to create sql query like "Select id, created_at at time zone 'pst' from account

Thanks,
Om
On Tue, Jun 26, 2018 at 3:12 PM, Lukas Eder <lukas...@gmail.com> wrote:
Hello,
Thanks for your message. As you've noticed also on your cross-posted Stack Overflow question...

... this syntax is not yet supported out of the box by jOOQ. The relevant feature request is:

You can always work around missing functionality by using plain SQL templating:

I hope this helps,
Lukas

Am Di., 26. Juni 2018 um 07:54 Uhr schrieb <ompraka...@xymob.com>:

Getting some issues with org.jooq api. Saving data into DB, in UTC format for timestamptz fields. When fetching the same from db, there is a way in postgres. 

select id, created_datetime at time zone 'pst' from account. 

Is there any way to achieve the same into jooq ?


selectStep = selectStep.select(fieldName).as(aliasName))

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/1PGtTt8JRTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

Omprakash Verma

unread,
Jun 26, 2018, 6:09:47 AM6/26/18
to jooq...@googlegroups.com
OK Got that.

Thanks,
Om

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/1PGtTt8JRTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/1PGtTt8JRTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages