• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 756
  • Last Modified:

Create Date from MMDDYYYY

I'm trying to find the best way to create a function to create a date in the format of MM/DD/YYYY from MMDDYYYY.  I've looked around but haven't been able to find anything that works.  I've tried convert() and a couple of other things but it doesn't recognize that format as a date.  I can't get the format that's provided changed.  

Thanks in advance for any help.
Tim
0
tim_cs
Asked:
tim_cs
1 Solution
 
Patrick MatthewsCommented:
SELECT SUBSTRING(SomeDate, 1, 2) + '/' + SUBSTRING(SomeDate, 3, 2) + '/' + SUBSTRING(SomeDate, 5, 4)
0
 
MilleniumaireCommented:
select to_char(to_date(mydate,'MMDDYYY'),'MM/DD/YYYY')
...
0
 
eszaqCommented:
It depends.
Where does your 'MMDDYYYY' come from? What datatype is it originally? And what are you trying to do? Is it for database input from some outside parameter? Or for ouput in your web application? Or processing inside database?
0
 
tim_csAuthor Commented:
matthewspatrick's suggestion seems to be working so far.  I'm just doing some more testing.  

eszaq
I'm importing data into a temp Table from a flat file.  Then processing the data to be stored in the proper DB tables.
0
 
eszaqCommented:
I see. Then yes, it's a string, with all the string functions available to your disposal
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now