I'm trying implement get method for variable has type "Date".
But when return, I want to return it with format "yyyy/MM/dd" and MUST be Date type.
Example: original date: 2018/01/01T15:00.00.000+0000
I want return: 2018-01-01 and MUST be date, not string
Can you help me in this case ?
解决方案
A Date is basically stored as a number of milliseconds since the epoch (1/1/1970). It can be formatted into a String in various ways (e.g. with SimpleDateFormat), but it is never stored as a String. So, what you're asking for is impossible and makes no sense.