1
0
-1

I am trying to sync a DateTime field from Zendesk to Jira. ZD is in the EST timezone and Jira is in the PST timezone.


ZD:-  Event Time (New) - Date(type) 

Jira:-  Event Time - Date Time Picker


Below is the result I am getting when I use the below code


ZD outgoing :

Jira Incoming:


Result

Date in Zendesk  selected is "June 16, 2023"

DateTime in JIRA showing is "Jun 15, 2023, 5:00 PM"


After this, I use the below code in Jira Incoming sync from one of the posts in the community

Link to the post



Using this I am getting below error.



    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi Shaleen Kukreti 


      Please put this in the incoming sync of Jira. For this example I added 5 hours, but you can just change that depending on your situation.


      Incoming Jira Cloud Sync
      import java.text.SimpleDateFormat
      import java.util.Calendar
      
      def dateString = "${replica.customFields."DateField".value}"
      def inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S")
      def date = inputFormat.parse(dateString)
      
      
      //hardcode 5 hours 
      def timestamp = date.time
      Calendar calendar = Calendar.getInstance()
      calendar.timeInMillis = timestamp
      calendar.add(Calendar.HOUR_OF_DAY, 5)
      def updatedTimestamp = calendar.timeInMillis
      
      issue.customFields."DateTime Field".value = updatedTimestamp


      Thank you.

      Kind regards,
      Mathieu Lepoutre

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Syed Majid Hassan any thoughts how to handle this ?

          CommentAdd your comment...