Re: Number format

I am trying another format to.
I have a text field where I write a number that is really a date.
When I type this: 23011971 and change field, I would like the program to insert dots so the field looks like this:
23.01.1971
I have written this:

Re: Number format

Those formatters are used for formatting number in fairly standardised ways. They also tend to use the locale to determine locale-specific separators.
They are not intended for formatting your number in every possible way.

Re: Number format

Originally Posted by Norm

Take a look at the SimpleDateFormat class

Uses this to convert the date from dd.MM.yyyy to java.sql.date for insert into mysql tables.
Also for select from mysql and displaying the date in the same format. This works perfectly.
As I mentioned in my last post, I would like to make a display of this format when I lose focus to the input field.

Re: Number format

Ksharp's one makes more sense if this is going to be the same every time and you never actually need the date as a Date.
Going from a string to a date and back again is going to be more "work" than simply plonking in a couple of '.' s.