View Single Post
Old 09-27-2010, 12:26 PM   #3
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by weasal View Post
I have a recipe that pulls a newspaper from another timezone and converts it to a mobi format book. I want to be able to control the publication date/time of the resulting book so it can be in the future.

For exmaple:

My local time is 6 pm, Sept 27, the newspaper's local time is 1 am next day, Sept 28 so the newspaper is from tomorrow (as far as I'm concerned).
At the moment, when I run the recipe, the publication date of the resulting book is Sept 27 and I want it to be Sept 28.

I noticed that the basic recipe uses nowf to obtain the dates for the publication date and timestamp used for the resulting book but I can't see a way to change the behavior.

Thanks!
read this:
http://docs.python.org/library/time.html#time.strptime

example (I have not tested):
Code:
import time
log = '16/Jan/2010:18:11:06 +0100'
dt = time.strptime(log, '%d/%b/%Y:%H:%M:%S +0100')
you might also be able to try this in the recipe under the title section
timefmt = ' [%a,%d %B %Y %I:%M %p +0100]'
TonytheBookworm is offline   Reply With Quote