How to convert date(string type) into date(date ti

2019-08-03 09:13发布

I am stuck with a Oracle query. In my dashboard app, we have to show a summary graph for total of details lines basically. In one particular tab, we need the datetime in the details, but we group on the summary by date only.

How to convert date(string type) into date(date time ) in oracle. I am using select within select in other words nested select. Inner query returns string date time, and outer query unable to convert this to date time

标签: oracle10g
2条回答
Animai°情兽
2楼-- · 2019-08-03 09:23

You would use the to_date function to convert a string to a date. For example

to_date( '2012-12-25 13:45:56', 'yyyy-mm-dd hh24:mi:ss' )

or

to_date( '12/25/98', 'MM/DD/RR' )

The format mask that you pass in as the second argument will depend on the format of the string. The set of valid format masks for the to_date function is in the documentation.

查看更多
ら.Afraid
3楼-- · 2019-08-03 09:28

You can use TO_DATE function.

For e.g:
If the input string in in the form 12/21/2012
You can try TO_DATE('12/21/2012', 'MM/DD/RRRR')

Check this link for more on variou formats: http://psoug.org/definition/TO_DATE.htm

查看更多
登录 后发表回答