Originally posted by Thara Visveswaran:
Try this
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
Date testDate = sdf.parse("4:00 pm");
DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL);
System.out.println(df.format(testDate));
I tried this code and got this result:
4:00:00 AM EST
I also tried to use the
pattern but I get errors
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ssZ");
It works when I use z instead of Z but I needed the whole TimeZone.