1 answer
- 210
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)
- Shaheel Luckoo
Thank you Juan. It's working. Youpie
- Shaheel Luckoo
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
This time a different TimeZone. How can I proactively cater for all TimeZones?
Thanks for your help
- Juan Grases
This looks like you need to do the same fix but in another line. Could you share the line that is failing?
- Shaheel Luckoo
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
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
Everything good. I forgot to amend the target. Thanks again for your help
Add your comment...
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