0

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

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by JamesCherrill
0

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?

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.