I am getting date in the format of YYYDD
, and I want to convert it in YYYY-MM-DD
, I tried several ways but no luck, any one has solution please suggest.
after searching on Google I got the below link, which has function to convert above data format but it is asking for two parameters one is input date string and second is number of days to add. any suggestion translateDateStr
Using
SimpleDateFormat
:would print out "2012-02-29"
Using Joda Time
format codes (from http://joda-time.sourceforge.net/api-release/index.html)
use SimpleDateFormat:
for storing the date in the format you want, you would do similar, just from the other direction...
http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html