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

x
?
Solved

Change '01/01/1980' date format to to_date('01/01/1980', 'MM/DD/YYYY')

Posted on 2011-03-03
4
Medium Priority
?
650 Views
Last Modified: 2012-05-11
hi,

i have come across this code:

s{(\d{1,2})/(\d{1,2})/(\d{1,4})}{$1-$2-$3}g;

the code is written in perl. it will change date format from  01/01/1980 to 01-01-1980.
I would like to amend it so that is will look for this date format '01/01/1980' (with single quote) and change in to this "to_date('01/01/1980', 'MM/DD/YYYY')" (exclude the double quote)

thanks in advanced.
0
Comment
Question by:gagajanice
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 35034217
This should do it:

s{(\d{1,2})/(\d{1,2})/(\d{1,4})}{to_date\('$1/$2/$3\'\, \'MM/DD/YYYY\'\)}g;

Open in new window

0
 

Author Comment

by:gagajanice
ID: 35034291
hi sjklein42,

thanks for the reply.
but the result is not what i desire: 'to_date('12/06/2010', 'MM/DD/YYYY')'

i would like to get rid of the single quote '...'.
how to include single quote as part of the date format at the first place.

 '01/01/1980' (with single quote) to  "to_date('01/01/1980', 'MM/DD/YYYY')" (exclude the double quote)



0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 2000 total points
ID: 35034309
s{\'(\d{1,2})/(\d{1,2})/(\d{1,4})\'}{to_date\('$1/$2/$3\'\, \'MM/DD/YYYY\'\)}g

Open in new window

0
 

Author Closing Comment

by:gagajanice
ID: 35034843
thank you so much!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

834 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