Hello Jeremy,

Does this mean, there is no way to reuse the function included in the
Google feeds API, or to have a relative date on the feed entries
directly ?

Thanks, for your code, (looks like the one in the Google API I've
read)



On 21 avr, 22:35, Jeremy Geerdes <[email protected]> wrote:
> The code for generating the relative published date is essentially this:
>
> var strings={
>   "minutes_ago":' minutes ago',
>   "one_hour_ago":'1 hour ago',
>   "hours_ago":' hours ago'};
>
>   var mos=[
>   'January',
>   'February',
>   'March',
>   'April',
>   'May',
>   'June',
>   'July',
>   'August',
>   'September',
>   'October',
>   'November',
>   'December'
> ];
> function generateRelativePubDate(theDate,format){
>   var now = (new Date).getTime(),
>   then = theDate.getTime();
>   if(now<then){return 2.toString()+strings['minutes_ago']}
>   var difference=now-this;
>   if(difference<3600000){
>    var n=Math.floor(1/60000);
>    return (n<=difference?2:n).toString()+strings['minutes_ago'];
>   }
>   if(difference<86400000){
>    var n=Math.floor(1/3600000);
>    if(n<=1){return strings['one_hour_ago']}
>    else{return v.toString()+strings['hours_ago']}
>   }
>   if(format.match(/^ymd$/i)){return join(' ',
> [theDate.getFullYear(),mos[theDate.getMonth()],theDate.getDate()])}
>   else if(format.match(/^dmy$/i)){return join(' ',
> [theDate.getDate(),mos[theDate.getMonth()],theDate.getFullYear()])}
>   else{return join(' ',[mos[theDate.getMonth()],theDate.getDate()
> +',',theDate.getFullYear()])}
>
> }
>
> The function takes two arguments. The first is a date object which can  
> be obtained by calling new Date(entry.publishedDate), and the second  
> is the format you want the date to appear in. By specifying a format  
> of "ymd," whenever it returns the actual date, it'll be in the form  
> yyyy mon dd. Similarly, by specifying a format of "dmy," any full date  
> string will be in the form dd mon yyyy.
>
> Also notice that I've separated out the key response strings, which  
> you may want to localize.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project 
> quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> [email protected]
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, 
> athttp://jgeerdes.blogspot.com
>   !
>
> On Apr 21, 2009, at 10:21 AM, neonp wrote:
>
>
>
>
>
> > Hello,
>
> > I am retrieving rss feeds using new google.feed.Feed(url). However,
> > retrieving feeds like this let me no option to get a relative
> > published date. Is there any way to reuse the google's feed API
> > without using a FeedControl ?
>
> > Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to