I'm trying to get the time stamp from the GPS.
I'm using the method onLocationChanged and the Date class like this:
public void onLocationChanged(Location location) {
Date date = new Date(location.getTime());
Log.d("TIME","day "+Calendar.get);
Log.d("TIME","month "+date.getMonth());
Log.d("TIME","year "+date.getYear());
Log.d("TIME","hour "+date.getHours());
Log.d("TIME","minutes "+date.getMinutes());
Log.d("TIME","seconds "+date.getSeconds());
}
now I know that these methods are deprecated but it's still suppose to give me accurate results right?
the min,sec and hour are fine but :
The day value is 1.
The month value is 1.
The year value is 115 .
How can I know if the problem is with the time I get from location or is it the Date class that's messing things up?
0 comments:
Post a Comment