I am new to Scala world, I wanted to use String.format() to create a date format string. I have three integer value year month and day, I wanted to change it in yyyy-mm-dd. String.format() expect an array of Anyref, when I am creating Array[Anyref] by passing integer value to it, it is throwing below error.
Error:(49, 30) the result type of an implicit conversion must be more specific than AnyRef dd(2) = inputCalendar.get(5)
My full example is :
val dd = new Array[AnyRef](3);
dd(0) = Integer.valueOf(inputCalendar.get(1))
dd(1) = Integer.valueOf(inputCalendar.get(2) + 1)
dd(2) = inputCalendar.get(5)
println(String.format("%04d-%02d-%02d",dd))
Note: I don't want to use any Date API for this.