JIRA Cloud Sync issue - No signature of method: java.sql.Timestamp.format() is applicable for argument types:

Originally asked by Shaheel Luckoo on 26 November 2020 (original question)


Hi Everyone:

I started having this issue after 2 years that the code has been in place and working.

No signature of method: java.sql.Timestamp.format() is applicable for argument types: (String, sun.util.calendar.ZoneInfo) values: [d/MMM/yy h:mm a, sun.util.calendar.ZoneInfo[id=“America/New_York”,offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]] Possible solutions: toYear(), from(java.time.Instant), from(java.time.Instant)

------------- Code --------------

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

def formatdate(dateString) {
def inputDateString = dateString
def inputDateFormat = “yyyy-MM-dd’T’HH:mm:ss.SSSX”
def outputDateFormat = “d/MMM/yy h:mm a”
def outputTZ = TimeZone.getTimeZone(‘America/New_York’)
def convertedDate = dateString.format(outputDateFormat, outputTZ)
return convertedDate
}

Can Someone help me? I am using exalate with Jira Cloud


Answer by Juan Grases on 26 November 2020

You need to replace

def convertedDate = dateString.format(outputDateFormat, outputTZ)

with:

def format =  new java.text.SimpleDateFormat(outputDateFormat)
format.setTimeZone(TimeZone.getTimeZone('America/New_York'))
def convertedDate = format.format(dateString)

Comments:

Shaheel Luckoo commented on 26 November 2020

Thank you Juan. It’s working. Youpie

Shaheel Luckoo commented on 26 November 2020

Hi Juan:

I got another error:

No signature of method: java.sql.Timestamp.format() is applicable for argument types: (String, sun.util.calendar.ZoneInfo) values: [d/MMM/yy h:mm a, sun.util.calendar.ZoneInfo[id=“America/Los_Angeles”,offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]] Possible solutions: toYear(), from(java.time.Instant), from(java.time.Instant)

Shaheel Luckoo commented on 26 November 2020

This time a different TimeZone. How can I proactively cater for all TimeZones?

Thanks for your help

Juan Grases commented on 26 November 2020

This looks like you need to do the same fix but in another line. Could you share the line that is failing?

Shaheel Luckoo commented on 26 November 2020

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

def formatdate(dateString) {
def inputDateString = dateString
def inputDateFormat = “yyyy-MM-dd’T’HH:mm:ss.SSSX”
def outputDateFormat = “d/MMM/yy h:mm a”
def outputTZ = TimeZone.getTimeZone(‘America/New_York’)
/* def convertedDate = dateString.format(outputDateFormat, outputTZ) */
def format = new java.text.SimpleDateFormat(“yyyy-MM-dd”)
format.setTimeZone(TimeZone.getTimeZone(‘America/New_York’))
def convertedDate = format.format(dateString)
return convertedDate
}

comment.body =

commented by " + comment.author.displayName + " - " + formatdate(comment.created) + "\n” + comment.body

Juan Grases commented on 26 November 2020

I don’t thin the error is coming from that code as you are not doing java.sql.Timestamp.format(), are you sure the error is not from another connection or that the error is not for another line of code?

Shaheel Luckoo commented on 26 November 2020

Everything good. I forgot to amend the target. Thanks again for your help

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