请你帮助我在当前日期之外的几天内获取正确的结果。
app503l:datechecker ~ $ date
Thu May 18 13:54:41 AEST 2017
如何添加55天?
答案 0 :(得分:1)
我得到了解决方案..!
def parse(self, response):
for item in response.xpath("//li[contains(@class, 'river-block')]"):
url = item.xpath(".//h2[@class='post-title']/a/@href").extract_first()
stamp = item.xpath(".//time/@datetime").extract_first()
yield scrapy.Request(url, callback=self.get_details, meta={'stamp': stamp})
def get_details(self, response):
article = ArticleItem()
article['title'] = response.xpath("//h1/text()").extract_first()
article['url'] = format(shortener.short(response.url))
article['stamp'] = response.meta['stamp']
yield article
我已经使用perl将55天添加到服务器上的当前本地时间。
谢谢..!
答案 1 :(得分:0)
怎么样:
now=$(date +%s)
new=$((now + 55*86400))
date -r $new
使用GNU日期:
date -d @$new