Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个格式为 DD/MM/YY (16/07/13) 的 字符串日期 如何将此字符串日期转换为 SQL 日期格式(保持相同的 DD/MM/YY 格式) 以存储在我的 Oracle DB 中。 ??
使用SimpleDateFormat:
SimpleDateFormat
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy"); String stringWithDate = "16/07/13"; Date theDate = sdf.parse(stringWithDate); //store theDate variable in your database...
请注意,SimpleDateFormat#parse抛出ParseException.
SimpleDateFormat#parse
ParseException