Solved

Oracle Date format

Posted on 2014-02-14
3
525 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 77

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 77

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 77

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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…
Via a live example, show how to take different types of Oracle backups using RMAN.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

732 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