格式化字符串到日期
Formatting a string to date
我有约会对象:'Fri Jul 24 13:11:04 CEST 2015'。如何将此字符串转换为日期?
最后我想做这样的事情:
to_char('Fri Jul 24 13:11:04 CEST 2015', 'DD/MM/YYYY HH24:MI:SS')
我尝试了一些方法,但到目前为止都失败了,出现了这个错误:
ORA-01858: - "a non-numeric character was found where a numeric was expected"
*Cause: The input data to be converted using a date format model was
incorrect. The input data did not contain a number where a number was
required by the format model.
*Action: Fix the input data or the date format model to make sure the
elements match in number and type. Then retry the operation.
我在这里可以做我想做的事吗?
你需要使用to_date
:
to_date('Fri Jul 24 13:11:04 CEST 2015', 'DD/MM/YYYY HH24:MI:SS')
http://ss64.com/ora/syntax-to_date.html
to_char
只需要数字
我有约会对象:'Fri Jul 24 13:11:04 CEST 2015'。如何将此字符串转换为日期? 最后我想做这样的事情:
to_char('Fri Jul 24 13:11:04 CEST 2015', 'DD/MM/YYYY HH24:MI:SS')
我尝试了一些方法,但到目前为止都失败了,出现了这个错误:
ORA-01858: - "a non-numeric character was found where a numeric was expected"
*Cause: The input data to be converted using a date format model was
incorrect. The input data did not contain a number where a number was
required by the format model.
*Action: Fix the input data or the date format model to make sure the
elements match in number and type. Then retry the operation.
我在这里可以做我想做的事吗?
你需要使用to_date
:
to_date('Fri Jul 24 13:11:04 CEST 2015', 'DD/MM/YYYY HH24:MI:SS')
http://ss64.com/ora/syntax-to_date.html
to_char
只需要数字