Return date type in Java format

See the English answer > change the format of date Java [closed]

Example: original date: 2018 / 01 / 01t15:00.00 000 0000

I want to return: 2018-01-01 and must be a date, not a string

Can you help me in this situation?

Solution

Dates are basically stored in milliseconds since the era (January 1, 1970) It can be formatted as a string in various ways (for example, using simpledateformat), but it will never be stored as a string Therefore, what you ask is impossible and meaningless

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>