0

我有一个格式为 DD/MM/YY (16/07/13) 的
字符串日期 如何将此字符串日期转换为 SQL 日期格式(保持相同的 DD/MM/YY 格式)
以存储在我的 Oracle DB 中。 ??

4

1 回答 1

3

使用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.

于 2013-07-23T20:54:56.850 回答