hi want to know how read date from a file and take the data into a 2D array and again convert it in 1D array and covert the data format like 15-02-2012 or 15 02 2012 or 15s02s2012 into 15/02/2012 format and write it to other file

Recommended Answers

All 3 Replies

You can write a Date object by using the SimpleDateFormat class with a format specification that describes exactly how you want it formatted. See the Java API documentation for details.
Inputting "any date format" is a much bigger problem - is there any limit or system to the range of input formats there could be?

i tried and i'm able to convert some data formats to the requered but i'm not able to convert all the date format like 02-02-2012 or 02$02$2012 like this...format

Are you saying its dd?mm?yyyy ie 3 numbers separated by an arbitrary delimiter?
If so you can use the String split(aRegex) method to break a string into pieces, using a given regular expression to determine where to split - eg ifyou use the regex fpr "anything that's not 0-9" (ask a Regex expert) those strings will split into a 3 element array containing dd, mm and yyyy respectively.

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.