How do we compare two java.sql.Date in scala?

We are having some dates in format java.sql.Date and we are going to compare them

import java.sql.Date
import org.apache.spark.sql.types.{DateType, IntegerType}
var x = Date.valueOf("2017-12-10")
var y = Date.valueOf("2018-12-10")
x: java.sql.Date = 2017-12-10
y: java.sql.Date = 2018-12-12
If we compare with an equal sign it work
x == y
res1: Boolean = false
But if we want to know wich one is bigger, it return an error:
x >= y
:37: error: value > is not a member of java.sql.Date

We are expecting it to return false .

How should we compare x and x...?

Tagged:
Sign In or Register to comment.