Solved

Oracle Date format

Posted on 2014-02-14
3
524 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
use lov values 2 61
how to find out the count of records based on the subfolders paths 11 32
SQL Workhours Count beetween Workhours 3 25
Fill Date time Field 12 23
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…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to take different types of Oracle backups using RMAN.

839 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