Oracle accept dates in '00-JAN-0000' format, is there any way i can change it to '00-01-0000'.

Recommended Answers

All 21 Replies

you might want to take a look into the DateFormat class.

@stultuske please change link to todays Java6 API, and maybe add SimpleDateFormat, my msg would be deleted by myself

that's about Java SQL Timestamnp :-) not date formating :-)

I don't seem to get the edit-button, so just next post :/
DateFormat Java 6

I thought the possibility of using SimpleDateFormat was a bit straightforward in that link, but since it's not the only option, I preferred to let the OP take his pick :)

i m not asking for java , i m asking for oracle....

Opps... Sorry i thought there isnt any oracle forum here.... Amazing to put databases in web development section.... Y not a seperate Menu for it....

since this is a java forum and Oracle owns java, you can see where the confusion orriginated, especially since the thread title

is there any mod who can move my this thread to oracle forum....

I don't know if it is helpful but in case you don't know:
Have you tried the to_date and to_char methods? They are sql oracle functions for converting dates to strings like the SimpleDateFormat in java.

If the column is of type DATE, then it will store date, no matter how your sql editor represents it. And you need to save date. So you can use the to_date function to convert the input: '03-05-2011' to a date with format:
'DD-MM-YYYY'

Amazing to put databases in web development section...not a seperate Menu for it....

Yes, that is very strange. It took me a while to find it. Does someone think that databases are only used via the web?

java Addict thanx... i already know about them.... I already know about NLS_DATA PARAMAETER, PROBLEM IS IT ISNT WORKING... so i came here to get some great advices from professionals.

I dont want to start new thread to ask a new question .... has any one used JCalander Api.... how can i set its feel and look to modern.... i have read the documentation but didnt get it.... so if any one already know he can save my time..

JFrame f = new JFrame();
			calendar = new JCalendar();
			f.add(calendar);
			f.setLocation(new Point(head.getCalendarButton().getLocation()));
			f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
			f.setSize(new Dimension(400,400));
			f.setVisible(true);

here is my code....

java Addict thanx... i already know about them.... I already know about NLS_DATA PARAMAETER, PROBLEM IS IT ISNT WORKING... so i came here to get some great advices from professionals.

In that case, can you explain what do you mean by that:

"Oracle accept dates in '00-JAN-0000' format, is there any way i can change it to '00-01-0000'."

What are you trying to do and it doesn't work. Also the admins should move this thread to the right forum in order for more experts to give better answers.

And I had a feeling that you knew about those functions. That is why I thought they would work.

I want oracle to take '01-01-0001' format as a default date format.... Right now its '01-jan-0001'....

hmmm again I want cleaned my car :-)

if you didn'd satisfied with built-in hepl in your Oracle Db Instalations, nor with official web pages, tutorials and community forums, than maybe this one can hepl you how to understand Sql Date, DateTime, TimeStamp http://www.java2s.com/Code/Oracle/CatalogOracle.htm (allways in graphic mode displayed from console and without formating in YYYY MM DD ...format)

I want oracle to take '01-01-0001' format as a default date format.... Right now its '01-jan-0001'....

If you are referring to the way the date is displayed when you run a query at your editor, maybe you need to change the settings of your editor?

If you want to insert values to a date column, you must insert only date, not the characters: '01-01-0001'
Again, I think that if you change the settings of your editor you might get the results you want,

but all the above are based on the fact that I understood correctly your question.

have you looked into NLS settings ?

From where i can set NLS Setting directly, i mean file name..... Or through query....

query only

SELECT * FROM NLS_DATABASE_PARAMETERS
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.