<div dir="ltr"><br><br>On Sun, Sep 7, 2008 at 1:36 PM, Wayne Watson <span dir="ltr">&lt;<a href="mailto:sierra_mtnview@sbcglobal.net">sierra_mtnview@sbcglobal.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



  

<div bgcolor="#ffffff" text="#000000">
Yes, cut and paste directly from the code. Positively a import as seen.
Here&#39;s the full set of code:<br>
<blockquote># The effect of adding seconds to date-time to see if day
gets changed<br>
import datetime<br>
dt1 = datetime.datetime(2008, 03, 10, 23, 59, 0)<br>
print dt1<br>
delta = datetime.timedelta(seconds = 200)<br>
print dt1+delta<div class="Ih2E3d"><br>
  <br>
# format conversion of date+time<br></div>
dt1 = time.strptime(&quot;20080421_101145&quot;, &quot;%Y%m%d_%H%M%S&quot;)<div class="Ih2E3d"></div></blockquote></div></blockquote><div>The first code you posted was different.&nbsp; You had datetime.strptime and
not time.strptime.&nbsp; Your problem is dt1 is a time.struct_time which has
no strftime method, producing the error.&nbsp; <br><br>You must have imported time somewhere.&nbsp; This line makes dt1 a time.struct_time which causes your problem.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><blockquote><div class="Ih2E3d"><br>
print &quot;dt1: &quot;,dt1<br>
other = dt1.strftime(&quot;%Y%m%d_%H%M%S&quot;)</div></blockquote></div></blockquote><div>Now dt1 is a time.struct_time and not a datetime.datetime object so it has no strftime method.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><br><div><div class="Wj3C7c"><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><blockquote>...<br>
# format conversion of date+time<br>
dt1 = datetime.strptime(&quot;20080421_101145&quot;, &quot;%Y%m%d_%H%M%S&quot;)</blockquote>
    </div>
  </blockquote>
  <div>I don&#39;t see how this works as written because the datetime
module doesn&#39;t have a strptime function. <br>
  </div>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">
    <blockquote></blockquote></div></blockquote></div></div></blockquote></div></div></div></blockquote><div><br>This is what you had before.&nbsp; Note datetime.strptime instead of time.strptime, which confused me because the datetime module doesn&#39;t have a strptime function.<br>
&nbsp;</div></div><br></div>