Here you can find the source of createPostgresTimeZone()
public static String createPostgresTimeZone()
//package com.java2s; //License from project: Open Source License import java.util.TimeZone; public class Main { /**//from w w w . j ava 2s .c om * Convert Java time zone to postgres time zone. All others stay the same * except that GMT+nn changes to GMT-nn and vise versa. * * @return The current JVM time zone in postgresql format. */ public static String createPostgresTimeZone() { String tz = TimeZone.getDefault().getID(); if (tz.length() <= 3 || !tz.startsWith("GMT")) { return tz; } char sign = tz.charAt(3); String start; if (sign == '+') { start = "GMT-"; } else if (sign == '-') { start = "GMT+"; } else { // unknown type return tz; } return start + tz.substring(4); } }