<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 24, 2007, at 12:27 AM, Lawrence Shafer wrote:</div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">How would I compare these two dates and extract the difference in H:M:S??</div></blockquote><div><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="http://docs.python.org/lib/module-datetime.html">http://docs.python.org/lib/module-datetime.html</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="http://docs.python.org/lib/datetime-timedelta.html">http://docs.python.org/lib/datetime-timedelta.html</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div></div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">22 Nov 2007 18:54:07</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">23 Nov 2007 23:24:23</div></blockquote><br></div><div><div>&gt;&gt;&gt; import datetime</div><div>&gt;&gt;&gt; a = datetime.datetime(2007,11,22,18,54,7)</div><div>&gt;&gt;&gt; b = datetime.datetime(2007,11,23,23,24,23)</div><div>&gt;&gt;&gt; c = b - a</div><div>&gt;&gt;&gt; hours = (c.seconds / (60*60))</div><div>&gt;&gt;&gt; minutes = (c.seconds - (hours * 60*60)) / 60</div><div>&gt;&gt;&gt; seconds = c.seconds - (hours * 60*60) - (minutes * 60)</div><div>&gt;&gt;&gt; print str((c.days*24) + hours) + ":" + str(minutes) + ":" + str(seconds)</div><div>28:30:16</div><div>&gt;&gt;&gt; </div></div><div><br class="webkit-block-placeholder"></div><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Sincerely,</div><div><br class="khtml-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Chris Calloway</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.seacoos.org">http://www.seacoos.org</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">office: 332 Chapman Hall cell: (919) 599-3530</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599</div><br class="Apple-interchange-newline"></span> </div><br></body></html>