Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can (<em>but no longer should</em> - see below!) use <a href="http://developer.android.com/reference/android/text/format/Time.html" rel="noreferrer">android.text.format.Time</a>:</p> <pre><code>Time now = new Time(); now.setToNow(); </code></pre> <p>From the reference linked above:</p> <blockquote> <p>The Time class is a faster replacement for the java.util.Calendar and java.util.GregorianCalendar classes. An instance of the Time class represents a moment in time, specified with second precision.</p> </blockquote> <hr> <p><strong>NOTE 1:</strong> It's been several years since I wrote this answer, and it is about an old, Android-specific and now deprecated class. Google now <a href="http://developer.android.com/reference/android/text/format/Time.html" rel="noreferrer">says</a> that "[t]his class has a number of issues and it is recommended that <a href="http://developer.android.com/reference/java/util/GregorianCalendar.html" rel="noreferrer">GregorianCalendar</a> is used instead".</p> <hr> <p><strong>NOTE 2:</strong> Even though the <code>Time</code> class has a <code>toMillis(ignoreDaylightSavings)</code> method, this is merely a convenience to pass to methods that expect time in milliseconds. The time value is <strong>only precise to one second</strong>; the milliseconds portion is always <code>000</code>. If in a loop you do</p> <pre><code>Time time = new Time(); time.setToNow(); Log.d("TIME TEST", Long.toString(time.toMillis(false))); ... do something that takes more than one millisecond, but less than one second ... </code></pre> <p>The resulting sequence will repeat the same value, such as <code>1410543204000</code>, until the next second has started, at which time <code>1410543205000</code> will begin to repeat.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload