dimanche 1 mars 2015

Scala how to instantiate new Option[java.sql.Date] type

I have var date_of_birth2 : Option[java.sql.Date] = None.


Later I have to fill date_of_birth2 by string.



String date = "01/01/1990"
var formate = new SimpleDateFormat("dd/MM/yyyy").parse(date)
var aDate = new java.sql.Date(formate.getTime());


But aDate is just the type of java.sql.Date. How can I assign?


var mdate_of_birth2 : Option[java.sql.Date] = date // date is just String type


Aucun commentaire:

Enregistrer un commentaire