Solved

Oracle Date format

Posted on 2014-02-14
3
520 Views
Last Modified: 2014-02-26
Hi,
I have a varchar2 field that captures a values for dates like 17/01/2014 09:24. I wanted to convert this char value to a date format like mm/dd/yyyy without time stamp. I tried using to_date(charfield,'mm/dd/yyyy') but it is giving me a "not a valid month" error. Please help.
0
Comment
Question by:baralp
  • 3
3 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39859993
regexp_substr(mycolumn,'^[^ ]+)

or
trunc(to_date('17/01/2014 09:24','DD/MM/YYYY HH24:MI')
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39860046
To be safe on the second one depending on how your default date format is:

to_char(to_date('17/01/2014 09:24','DD/MM/YYYY HH24:MI'),'DD/MM/YYYY')

>>'mm/dd/yyyy') but it is giving me a "not a valid mon

It appears your data isn't in mm/dd/yyy format but dd/mm/yyyy format.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39860083
I should also point out that since your input data appears to be in dd/mm/yyyyy format, are you sure you want to convert it to "mm/dd/yyyy"

If you do, just change the format.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to recover a database from a user managed backup

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now