import datetime
curr_date = datetime.datetime.now()
final_date = curr_date.strftime('%h %d %H:%M:%S')
print "::::FINAL DATE:::::",final_date

here is the demo to convert the current date into yr needed format 

> 
> Message: 4
> Date: Thu, 19 Feb 2009 16:29:01 +0530
> From: LOhit <lohi...@gmail.com>
> Subject: [BangPypers] date/time difference between two dates
> To: bangpypers@python.org
> Message-ID:
>       <29117e150902190259j700bc28bp3975fe8c0e7b3...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hello All,
> 
> I am parsing a log file to extract data for the last one week from the
> current date. The log file does not record the year, only month, day of the
> month and time.
> 
> My question is, the date is in "Month day-of-the-month time" format in the
> log file (ex. "Nov 22 15:15:42") and the current date I get from "datetime"
> module is in ISO format. How do I convert the date in log file to ISO
> format(or any other format) and then compare with the current date/time.
> 
> I am sure this will sound like a simple problem to you experts, but, I am
> not a programmer. I am a python enthusiast trying to automate few of my
> jobs.
> 
> Thanks,
> 



________________________________________________________________________

Thanks & Regards,
Ruchir Shukla
Application Engineer




<<attachment: openerp_big.png>>

_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to