例如,字符串值为:
15/08/2013 15:30 GMT+10:00
我想在 Java 中将上面的字符串格式化为 15/08/2013
(删除时间部分,只保留日期)。
我该怎么做这种格式?
最佳答案
Remove time part and only keep date
String dateString= "15/08/2013 15:30 GMT+10:00";
String result = dateString.split(" ")[0];
这给你 15/08/2013
我想不需要格式化程序。
关于java - 格式化日期字符串以删除 JAVA 中的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18843429/