[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 752
  • 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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

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