API docs say that Location.time() returns UTC time of a *fix*, so it's
not even a current time ...

...but it doesn't matter, since you create GregorianCallendar in UTC
time zone anyway, so what exactly did you expect?

Try using TimeZone.getDefault() instead.





On 3 May 2012 11:57, Bunty syed <[email protected]> wrote:
> Hi,
>
>  I changed the time & date of the device..
>
>  Then i launched an app which reads time & date using location.getTime
> Api as follows---
>
> long time =loc.getTime();
> GregorianCalendar gcal = new
> GregorianCalendar(TimeZone.getTimeZone("UTC"));
> gcal.setTimeInMillis(time);
>
> Log.i("Ashiq", "day======"+gcal.get(GregorianCalendar.DAY_OF_MONTH));
>                                        Log.i("", 
> "month======"+gcal.get(GregorianCalendar.MONTH));
>                                        Log.i("", 
> "yearc======"+gcal.get(GregorianCalendar.YEAR));
>                                        Log.i("", 
> "hrs======"+gcal.get(GregorianCalendar.HOUR));
>                                        Log.i("", 
> "minsc======"+gcal.get(GregorianCalendar.MINUTE));
>
>
> But above API returns me time & date as per the device time..
>
> Actually it should return the correct time(sataellite or cell tower
> based) independent of the device time & date.
>
> Thanks & Regards,
> Ashiq Sayyad
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to