I'm trying to get the milliseconds from an string that contains a date, but seems that I'm getting the wrong value. This is the string im trying to parse: 2015-03-01 00:00:00
,
I'm doing this to parse it:
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
Date inputDate = dateFormat.parse(data.get(position).getValidTo());
Log.d("--", inputDate.getDay() + " | " + inputDate.getMonth());
Use "MM"
instead of "mm"
to get month. ("mm" stands for minutes)
And inputDate.getTime()
will give the time in milliseconds.