Converting string to

Hello All,
I’m in need of to compare a time interval between two time_stamp
where one from database and for another i use function
then to calculate time difference i used function called
when i passed the 2 arg inside this function the first arg from database is showing like
TypeError: minutesBetween(): 1st arg can’t be coerced to java.util.Date
Any suggestion would be appreciated

If it’s coming in as a string, try using


What is the column type in the database table where the date is stored?

it was timestamp without timezone

And it’s coming in as a string? Or are you coercing it to a string?

What datatype do you get when you use something like print type(myTimeStampValue)?

Hi @JordanCClark,
Sorry for the delay in reply the datatype was not a string it’s an arrayList

Thanks & Regards,

Well, that’s because you grabbed it as a list. :wink:

What about type(sri[0]) to get the type of the first value of the list?

Hey sorry @JordanCClark,
it was <type ‘java.util.Date’>

No worries, Sri.

Huh. Well, there shouldn’t be an issue with minutesBetween() then.

That’s fine man i used some other methods actually my requirement was changed from checking DB time to current time

1 Like