<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.14.1">
</HEAD>
<BODY>
import datetime<BR>
curr_date = datetime.datetime.now()<BR>
final_date = curr_date.strftime('%h %d %H:%M:%S')<BR>
print "::::FINAL DATE:::::",final_date<BR>
<BR>
here is the demo to convert the current date into yr needed format
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Message: 4</FONT>
<FONT COLOR="#000000">Date: Thu, 19 Feb 2009 16:29:01 +0530</FONT>
<FONT COLOR="#000000">From: LOhit <<A HREF="mailto:lohit.b@gmail.com">lohit.b@gmail.com</A>></FONT>
<FONT COLOR="#000000">Subject: [BangPypers] date/time difference between two dates</FONT>
<FONT COLOR="#000000">To: <A HREF="mailto:bangpypers@python.org">bangpypers@python.org</A></FONT>
<FONT COLOR="#000000">Message-ID:</FONT>
<FONT COLOR="#000000">        <<A HREF="mailto:29117e150902190259j700bc28bp3975fe8c0e7b31dd@mail.gmail.com">29117e150902190259j700bc28bp3975fe8c0e7b31dd@mail.gmail.com</A>></FONT>
<FONT COLOR="#000000">Content-Type: text/plain; charset="iso-8859-1"</FONT>
<FONT COLOR="#000000">Hello All,</FONT>
<FONT COLOR="#000000">I am parsing a log file to extract data for the last one week from the</FONT>
<FONT COLOR="#000000">current date. The log file does not record the year, only month, day of the</FONT>
<FONT COLOR="#000000">month and time.</FONT>
<FONT COLOR="#000000">My question is, the date is in "Month day-of-the-month time" format in the</FONT>
<FONT COLOR="#000000">log file (ex. "Nov 22 15:15:42") and the current date I get from "datetime"</FONT>
<FONT COLOR="#000000">module is in ISO format. How do I convert the date in log file to ISO</FONT>
<FONT COLOR="#000000">format(or any other format) and then compare with the current date/time.</FONT>
<FONT COLOR="#000000">I am sure this will sound like a simple problem to you experts, but, I am</FONT>
<FONT COLOR="#000000">not a programmer. I am a python enthusiast trying to automate few of my</FONT>
<FONT COLOR="#000000">jobs.</FONT>
<FONT COLOR="#000000">Thanks,</FONT>
</PRE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
<HR NOSHADE>
Thanks & Regards,
Ruchir Shukla
Application Engineer
</PRE>
<IMG SRC="cid:1235042300.15032.0.camel@ping" WIDTH="179" ALIGN="bottom" BORDER="0"><BR>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>