How to get the current original time regardless of the device time?

Today is October 21, 2014. I have set my android phone time to October 20, 2014. What I want is the original current time from the device. I heard that this is possible.

What I did was check these codes:

            SimpleDateFormat  sdf = new SimpleDateFormat("dd-MM-yy");
            Time now = new Time("GMT+05:30");
            now.setToNow();
            now.format("%c");
            String l1 = sdf.format(new Date(now.toMillis(true)));
            String l2 = sdf.format(new Date(now.toMillis(false)));
            String l3 = sdf.format(new Date(Calendar.getInstance(TimeZone.getTimeZone("GMT+05:30")).getTimeInMillis()));
            String l4 = sdf.format(new Date(System.currentTimeMillis()));
            String l5 = sdf.format(new Date(new Date().getTime()));

      

All of the above strings l1, l2, l3, l3, l4, l5 return the same date as "20-10-14". But I need the original current time, that is, "21-10-14".

Any help?

+3


source to share





All Articles