I am storing the dates in a SQLite database in this format:
d-MMM-yyyy,HH:mm:ss aaa
When I retrieve the date with that format I am get every thing fine
except the hour. The hour is always 00
. Here is my output:
String date--->29-Apr-2010,13:00:14 PM
After convrting Date--->1272479414000--Thu Apr 29 00:00:14 GMT+05:30 2010
Here is the code:
Date lScheduledDate = CalendarObj.getTime();
DateFormat formatter = new SimpleDateFormat("d-MMM-yyyy,HH:mm:ss aaa");
SomeClassObj.setTime(formatter.format(lScheduledDate));
String lNextDate = SomeClassObj.getTime();
DateFormat lFormatter = new SimpleDateFormat("d-MMM-yyyy,HH:mm:ss aaa");
Date lNextDate = (Date)lFormatter.parse(lNextDate);
System.out.println("output here"+lNextDate);
What am I doing wrong?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…