我要求将传入日期字符串格式"20130212"(YYYYMMDD)转换为12/02/2013(DD/MM/YYYY)
使用ThreadLocal.我知道一种方法可以做到这一点,没有ThreadLocal.谁能帮我?
转换没有ThreadLocal:
final SimpleDateFormat format2 = new SimpleDateFormat("MM/dd/yyyy");
final SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd");
final Date date = format1.parse(tradeDate);
final Date formattedDate = format2.parse(format2.format(date));
Run Code Online (Sandbox Code Playgroud)