# Sync DateTime Field in ZD with Date Field in Jira

**URL:** https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510
**Category:** General Questions
**Tags:** exalate, usecase, jira-cloud, zendesk, migrated\_question
**Created:** [November 4, 2024, 8:09am UTC](https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510 "2024-11-04T08:09:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:09am UTC](https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510/1 "2024-11-04T08:09:33Z")

</div>

_Originally asked by Shaleen Kukreti on 14 June 2023 [(original question)](https://oldcommunity.exalate.com/questions/58502806)_

* * *

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 : ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/a78c202721dd1810300e407911e5888860be7b90.png)

Jira Incoming: ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/77091b5eed6833f4fed982be5cb0cf233e0747be.png)

**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](https://community.exalate.com/questions/11340866/sync-datetime-field-in-jira-with-date-field-in-zendesk)

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/83845ede73bd51ed1a2a7da55c7d858cda3ad59e.png)

Using this I am getting below error.

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/1eab3af9287468e952b554df71b0bc522d28a527.png)

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:09am UTC](https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510/2 "2024-11-04T08:09:34Z")

</div>

_Answer by Mathieu Lepoutre on 26 June 2023_

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**

```auto
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

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:09am UTC](https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510/3 "2024-11-04T08:09:35Z")

</div>

_Answer by Shaleen Kukreti on 16 June 2023_

Hi Syed Majid Hassan any thoughts how to handle this ?

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 6, 2024, 8:10am UTC](https://community.exalate.com/t/sync-datetime-field-in-zd-with-date-field-in-jira/5510/4 "2024-11-06T08:10:24Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
