Help comparing java sql timestamp and java util date

What are some efficient solutions when comparing datetime records from a SQL Server with date objects from system.date.*?

I tried to convert both dates to millis with system.date.toMillis() but then I’m left with the following:

a = 1598263200000
b = 1598263200000L
if a==b:
    print True

I’ve asked about the L that sometimes appears, its a jython thing, but for all intents and purposes I believe those numbers. Does this not print true? You can always try typecasting perhaps.

If you do

print str(type(a))
print str(type(b))

What do you see?

You can compare them directly using those java.util.Date objects’ native .equals(), .before(), or .after() methods.

1 Like

Or also system.date.isAfter, isBefore, etc.