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
android date datetime


source to share


No one has answered this question yet

See similar questions:

52
Android get current UTC time
45
How can I get the "network" time (from the "Automatic" option called "Use network values") and not the time on the phone?

or similar:

3796
How do you get the timestamp in JavaScript?
2568
How to find the current time in Python
2102
How do I get the current date in JavaScript?
1039
Get current time and date on Android
871
Get the current year in JavaScript
831
How do I use PHP to get the current year?
762
How do I find out the current date and time in PHP?
653
How to get the current date / time in Java
591
How to get the current time in YYYY-MM-DD HH: MI: Sec.Millisecond format in Java?
558
Get the current language in the device



All Articles
Loading...
X
Show
Funny
Dev
Pics