0

I'm using a Java JPA @query(...) tag where I use current_timestamp to insert a GTM time to the azure db table. I'm wondering if there is an easy way to set the timezone of the current_timestamp when I insert my timestamp. Something like

"UPDATE schema.tablename SET column = current_timestamp in zone 'timezone here'

adamB
  • 43
  • 5

1 Answers1

0

Replace timezone in your query with any of the following ways to set time zone in java code.

  1. Add TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
  2. Add @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")` on `createdOn() method

References: spring.jpa.properties.hibernate.jdbc.time_zone applied on writes but not on reads? and Timezone issue in Spring Boot JPA application

Madhuraj Vadde
  • 1,099
  • 1
  • 5
  • 13