I am using below code to parse text to date datatype and get respective long value.
import java.text.DateFormat
import java.text.SimpleDateFormat
String TIMEZONE_DATE_FORMAT = "yyyy-MM-dd'T'hh:mm:ssZ";
DateFormat df = new SimpleDateFormat(TIMEZONE_DATE_FORMAT);
Date date = df.parse("2015-09-21T12:48:00+0000");
date.getTime();
In the above case I get getTime()
value as: 1442796480000
which is 12:48 AM(GMT)
. But I am expecting 12:48 PM
as its 24 hr format.
When I use the same code with text date: 2015-09-21T13:48:00+0000
, I get 1:48 PM which is correct.
Am I using the wrong date format?