Different date-time on author and publish due to server timezone difference | Community
Skip to main content
Level 2
October 16, 2015
Solved

Different date-time on author and publish due to server timezone difference

  • October 16, 2015
  • 2 replies
  • 880 views

Hi,

I have my Author and Publish app servers in different locations and due to this i am having issues when i try fetching time from a date property.

node = hit.getNode(); String dateField = node.getProperty("start").getValue().getString(); out.println(dateField); //2015-04-20T07:15:00.000-05:00 Property startProp = node.getProperty("start"); Calendar startCal = startProp.getDate(); String formattedDate = new SimpleDateFormat("yyyy-MM-dd hh:mm aa").format(startCal.getTime()); out.println("Output= " + formattedDate); Publish: Output= 2015-04-20 12:15 PM Author:  Output= 2015-04-20 07:15 AM
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

Hi,

Store these dates in GMT and convert back to respective locale datetime from GMT

2 replies

joerghoh
Adobe Employee
Adobe Employee
October 16, 2015

Hi,

what do you expect? SimpleDateFormat always uses the timezone inherited from the system, unless specified otherwise. You can set set the timezone explicitly by calling the setTimezone() method on a SimpleDateFormat object. As far as I can see, this is not an AEM specific problem.

kind regards,
Jörg

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 2015

Hi,

Store these dates in GMT and convert back to respective locale datetime from GMT