I have a string with this value, for example: "20130211154717" I want it to be like "2013-02-11 15:47:17". How can I do that?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can use the
substring()
method to get what you want:and then string them together:
What you want to use for this is a SimpleDateFormat. It has a method called parse()
You can use regular expressions for that:
Though, I like assylias's
SimpleDateFormat
answer better. :-)You can use two SimpleDateFormat: one to parse the input and one to produce the output: