We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

Java Parse Date into Oracle

CSecurity
CSecurity asked
on
830 Views
Last Modified: 2012-08-13
Hello

I have a parser JSP which reads a page.

I receive date in different formats:

MM/DD/YYYY

or mm/dd/yyyy hh:mm:ss

or alot of other formats.

Even this:
Fri, 28 Sep 2007 21:56:59 +0000

I want to put this to my Oracle db which if timedate. How can I convert all kind of formats to time/date, like this:

29-SEP-07

A simple Java code is enough.

Thanks from now!
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
Accepting data in many formats is asking for trouble. You should do the reverse, constraining input as tightly as possible. Use drop downs, cleary marking which fields are which
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Any example code related to this stuff?
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
CERTIFIED EXPERT
Top Expert 2016

Commented:
Of course all that req.getPararmeter should be req.getParameter
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
When inserting date into oracle use a pREPAREDStatement, that will avoid any need to format your parsed timestamp.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.