Java Date.toString() method produces two different results on different linux servers

We are getting “org.postgresql.util.PSQLException: ERROR: invalid input syntax for type timestamp: “Wed Jun 26 23:27:35 TRT 2024″” as an exception when our application tries to insert the given date to a timestamp (PostgreSQL) column. I assume it is because of the timezone being TRT instead of EET. This only occurs in one of our linux servers and not on any others which indicates that it is an environmental issue but I couldn’t locate what might be causing it. We are using new Date(System.currentTimeMillis()) to get the date.

I have tried checking the time zone of the servers by using date and datectl but they are identical with both of them being in the GMT+3 timezone. I also created a small application to check JVM and user time zone. Here is the code:

System.out.println("JVM Time Zone : " + java.util.TimeZone.getDefault().getID());
System.out.println("User Time Zone : " + System.getProperty("user.timezone"));
System.out.println("Milliseconds : " + System.currentTimeMillis());
Date date = new Date(System.currentTimeMillis());
System.out.println(date.toString());

When I ran this application it gave the same result in both of the servers (disregarding the difference in miliseconds time that it takes for me to run the application). I have also used the command locale to check if there is any difference in the locale of the servers but it was the same. Another thing I checked was the Java versions as apparently the time zone changes between java 1.8 and java 17 for Turkey. While 17 gave TRT, 1.8 gave EET as the time zone when I ran it on my local computer. So I checked the versions of java between servers but it was the same. I also checked to see if there is any parameters passed when the Jboss server we are using is starting. Here is the parameters when I look at the processes:

java -D[Standalone] -server -XX:+UseCompressedOops -verbose:gc -Xloggc:/opt/jboss-eap-6.4/standalone1/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Dorg.jboss.boot.log.file=/opt/jboss-eap-6.4/standalone1/log/server.log -Dlogging.configuration=file:/opt/jboss-eap-6.4/standalone1/configuration/logging.properties -jar /opt/jboss-eap-6.4/jboss-modules.jar -mp /opt/jboss-eap-6.4/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/jboss-eap-6.4 -Djboss.server.base.dir=/opt/jboss-eap-6.4/standalone1 -Djboss.server.base.dir=/opt/jboss-eap-6.4/standalone1 -Djboss.bind.address=<IP> -Djboss.bind.address.management=<IP> --server-config=standalone.xml

I checked this post but it differs from this question since in this problem it shows the same result when timedatectl is used. We have multiple applications that uses the new Date(System.currentTimeMillis()) to get the current date so if there is a solution that does not involve changing it I would appreciate it.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật