Yahoo Pipes: How to convert string from Fetch Page into date for RSS feed?
I am trying to create a rss feed from a web page. I am able to get the data to create the title, but I am trying to get the date updated correctly. There is a string on the page, that tells what time of day the news was reported, such as "Time of Report: 1pm". So how can I get the "1pm" and convert that to a date string that contains the current date, w开发者_运维问答ith this time? Thanks, CP
The Pipes "Date Builder" module is surprisingly powerful.
You can actually feed it a string like "1pm" and it will return:
hour21
timezoneUTC
second0
month1
minute0
utime1264021200
day20
day_of_week3
year2010
The date is relative to when you run it - in this case it assumes "1pm Today". The result is "hour21" in UTC because it parsed in Yahoo's time-zone. So if you need something specific, use the "Sting Builder" to append the time-zone. For example "1pm GMT" gives:
hour13
timezoneUTC
second0
month1
minute0
utime1263992400
day20
day_of_week3
year2010
Obviously you may run into issues if your pipe runs after a date change - an "11pm" entry could easily be read the following morning, leading to inaccurate results.
精彩评论