Guest User

Untitled

a guest
Jan 5th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. useTimezone=true
  2. serverTimezone=UTC
  3. useLegacyDatetimeCode=false
  4.  
  5. jdbc:mysql://hostname/databaseName?useTimezone=true&serverTimezone=UTC&useLegacyDatetimeCode=false
  6.  
  7. @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime",
  8. parameters = { @Parameter(name = "databaseZone", value = "UTC")})
  9. private DateTime dateTime;
  10.  
  11. <property name="hibernate.jdbc.time_zone" value="UTC"/>
  12.  
  13. TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC"));
  14.  
  15. Date localTime = getDateFromDB();
  16. String format = "yyyy/MM/dd HH:mm:ss";
  17. SimpleDateFormat sdf = new SimpleDateFormat(format);
  18.  
  19. sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
  20. Date gmtTime = new Date(sdf.format(localTime));
Add Comment
Please, Sign In to add comment