import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class TestJulian { public static void main(String[] args) { SimpleDateFormat _dateformat = new SimpleDateFormat("yyyyDDD"); Date _date = null; String input = "2016103"; try { /** input is julian date of format * yyyyDDD */ _date = _dateformat.parse(input); } catch (ParseException e) { System.out.println("Parse Exception error"); e.printStackTrace(); } SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy"); String newDate = dateformat.format(_date); System.out.println("Date is :" + newDate); } } Output: Date is :12/04/2016
This comment has been removed by the author.
ReplyDelete:-bd
ReplyDelete