Problems using SimpleDateFormat

前端 未结 4 1060
死守一世寂寞
死守一世寂寞 2021-01-21 08:20

Apparently, I\'m missing something fundamental. I\'m having a problem with formatting the value of a jspinner. I\'ve tried a couple different ways and keep receiving an error, d

4条回答
  •  生来不讨喜
    2021-01-21 08:54

    I suspect the problem is this:

    dateFrom.getValue().toString()
    

    I suspect dateFrom.getValue() is just returning a Date - which of course doesn't have any associated format. Instead of parsing that, you should just cast it:

    Date from = (Date) dateFrom.getValue();
    

    I could be wrong, of course... but that would be my first thought.

提交回复
热议问题