java - Writing dates in csv files, some output as ###### -


i writing application let threads write csv files random numbers , random dates. however, of dates output ######, when click them in excell, show correct date (e.g.11/4/2014 shows ###### in excell, when click on cell, in fx field show 11/4/2014).

here how write dates:

    random random = new random();     bufferedwriter bufferedwriter;     gregoriancalendar cal = new gregoriancalendar();     dateformat df = new simpledateformat("dd/mm/yyyy");       writeline(random, bufferedwriter, cal, df);  private void writeline(random random, bufferedwriter bufferedwriter, gregoriancalendar cal, dateformat df) throws ioexception {         string randomdatestring;         bufferedwriter.write(double.tostring(random.nextdouble() * 100));         bufferedwriter.write(",");         randomdatestring = createrandomdate(random, cal, df);         bufferedwriter.write(randomdatestring);         bufferedwriter.newline();     }   private string createrandomdate(random random, gregoriancalendar cal, dateformat df) {         int randomdayoftheyear;         date randomdate;         string randomdatestring;         randomdayoftheyear = random.nextint(365) + 1;         cal.set(calendar.year, 2014);         cal.set(calendar.day_of_year, randomdayoftheyear);         randomdate = cal.gettime();         randomdatestring = df.format(randomdate);         return randomdatestring;     } 

###### piece of text excel uses mark cells not wide enough display entire number within them. happens numbers. writing csv file correctly. have expand column in excel can display whole date.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -