Alright thank you for your answers. That oneliner looked nice.
Adrian Sandor wrote: > Hi, the javadocs are at > http://joda-time.sourceforge.net/api-release/ , read > them and use them. In particular, you may be > interested in the "plus..." and toString(String > pattern) methods of DateTime. Read the DateTimeFormat > docs to understand the pattern syntax in detail. > > Since somebody already replied with a program, I'll > also write my version, which is a one-liner: > > System.out.println(new > DateTime().plusDays(1).toString("yyyy-M-dd")); > > Adrian > > --- Shervin Asgari <[EMAIL PROTECTED]> wrote: > > >> Hi. >> >> I am a first time user of Joda-Time. I need to >> output a date in a >> certain format and also add one day to the current >> day. >> >> I have this code: >> DateTime dt = new DateTime(); >> System.out.println(dt.getYear() + " " + >> dt.getMonthOfYear() + " " + >> dt.getDayOfMonth()+1); >> >> The problem is that I need this output to be in a >> certain format. Like >> yyyy-MM-dd and MM outputs 6 and not 06. >> How can I make this happen? >> >> I tried >> DateTimeFormatter fmt = >> DateTimeFormat.forPattern("yyyy-MM-dd"); >> but System.out.println(fmt); only writes the memory >> allocation :-/ >> >> I also tried DateTimeFormatter fmt = >> DateTimeFormat.forPattern("yyyy-MM-dd"); with the >> same result. >> >> Any suggestions? >> >> Shervin >> >> >> > ------------------------------------------------------------------------- > >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 >> express and take >> control of your XML. No limits. Just data. Click to >> get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Joda-interest mailing list >> [email protected] >> >> > https://lists.sourceforge.net/lists/listinfo/joda-interest > > > > > > ____________________________________________________________________________________ > No need to miss a message. Get email on-the-go > with Yahoo! Mail for Mobile. Get started. > http://mobile.yahoo.com/mail > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Joda-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Joda-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/joda-interest
