Unable to convert back changed date time to timeStamp in python
<p>I want to convert  <code>timestamps</code> to <code>dates</code> and truncate <code>minute</code> and <code>seconds</code>,then, convert it back to <code>timestamps</code>. I know I can do that with some mathematical algorithm like  <code>timestamps/60</code> or <code>timestamps/3600</code>, but I want to use <code>Python</code> provided functions. My code is like below. I tried two methods:</p>

<pre><code>for timeStamp in lineTimeStamps:
    #first try 
    day1=datetime.datetime.\
        fromtimestamp(float(timeStamp)).strftime("%Y-%m-%d %H")
    timestamp1 = time.mktime(day1)
    #second try 
    day2=datetime.datetime.\
        fromtimestamp(float(timeStamp)).\
        replace( minute=0, second=0, microsecond=0).timetuple()
    timestamp2 = time.mktime(day2)
</code></pre>

<p>In <code>timestamp1 = time.mktime(day1)</code>, I got the error like:</p>

<blockquote>
  <p>TypeError: Tuple or struct_time argument required</p>
</blockquote>

<p>In <code>timestamp2 = time.mktime(day2)</code>, I got the error like:</p>

<blockquote>
  <p>OverflowError: mktime argument out of range</p>
</blockquote>

<p>How can I convert it back to <code>timestamps</code>? </p>