<div dir="ltr"><br><br>On Sun, Sep 7, 2008 at 1:36 PM, Wayne Watson <span dir="ltr"><<a href="mailto:sierra_mtnview@sbcglobal.net">sierra_mtnview@sbcglobal.net</a>></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'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("20080421_101145", "%Y%m%d_%H%M%S")<div class="Ih2E3d"></div></blockquote></div></blockquote><div>The first code you posted was different. You had datetime.strptime and
not time.strptime. Your problem is dt1 is a time.struct_time which has
no strftime method, producing the error. <br><br>You must have imported time somewhere. This line makes dt1 a time.struct_time which causes your problem.<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><div class="Ih2E3d"><br>
print "dt1: ",dt1<br>
other = dt1.strftime("%Y%m%d_%H%M%S")</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> </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("20080421_101145", "%Y%m%d_%H%M%S")</blockquote>
</div>
</blockquote>
<div>I don't see how this works as written because the datetime
module doesn'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. Note datetime.strptime instead of time.strptime, which confused me because the datetime module doesn't have a strptime function.<br>
</div></div><br></div>