我有以下String
代表时间。
7pm
我希望将其转换为以下格式:
19:00
我已经使用以下方法来创建具有原始时间的DateTime对象。
DateTimeFormatter oldFormat = DateTimeFormat.forPattern("hha");
DateTime oldTime = oldFormat.parseDateTime("7pm");
现在我希望将其转换为24小时制:
DateTimeFormatter newFormat = DateTimeFormat.forPattern("HH:mm");
DateTime formatted = newFormat.parseDateTime( << oldTime >>);
我该怎么做才能达到类似于最后一行的内容?