I am newbie in Python and i m trying to do the following.
In PHP if we want to convert the date we use something like this:
$item_date = date("Y-m-j G:i:s", strtotime($RSSitem->pubDate));
Now, i m trying to do the same using Python, but i cant understand the exact method for doing it.
Can anyone help me by writing this line to python?
According to RSS specification pubDate
must follow RFC822:
mytime.strftime("%a, %d %b %Y %H:%M:%S %z")
There are two parts:
datetime.strptime()
function otherwise you could use dateutil.parser.parse()
or feeparser._parse_date()
(the later might be easier to install)..strftime()
method/time.strftime()
function.See strftime() and strptime() behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With