Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://docs.python.org/library/time.html" rel="noreferrer">online docs</a> have a handy table (what you call "unix time" is more properly called "UTC", for "Universal Time Coordinate", and "seconds since the epoch" is a "timestamp" as a float...):</p> <blockquote> <p>Use the following functions to convert between time representations:</p> </blockquote> <pre><code>From To Use seconds since the epoch struct_time in UTC gmtime() seconds since the epoch struct_time in local time localtime() struct_time in UTC seconds since the epoch calendar.timegm() struct_time in local time seconds since the epoch mktime() </code></pre> <p>where the unqualified function names come from the <code>time</code> module (since that's where the docs are;-). So, since you apparently start with a <code>struct_time in UTC</code>, use <code>calendar.timegm()</code> to get the timestamp (AKA "seconds since the epoch"), subtract <code>15 * 60 = 900</code> (since the units of measure are seconds), and put the resulting "seconds since the epoch" back into a <code>struct_time in UTC</code> with <code>time.gmtime</code>. Or, use <code>time.mktime</code> and <code>time.localtime</code> if you prefer to work in local times (but that might give problem if the 15 minutes can straddle the instant in which it switches to DST or back -- always working in UTC is <em>much</em> sounder).</p> <p>Of course, to use <code>calendar.timegm</code>, you'll need an <code>import calendar</code> in your code (imports are usually best placed at the top of the script or module).</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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