[BangPypers] date/time difference between two dates

Ruchir Shukla ruchiryshukla at gmail.com
Thu Feb 19 12:19:02 CET 2009

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 <lohit.b at gmail.com>
> Subject: [BangPypers] date/time difference between two dates
> To: bangpypers at python.org
> Message-ID:
> 	<29117e150902190259j700bc28bp3975fe8c0e7b31dd at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090219/4c93207b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openerp_big.png
Type: image/png
Size: 8725 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090219/4c93207b/attachment-0001.png>

More information about the BangPypers mailing list