Gossamer Forum
Home : Products : Gossamer Links : Discussions :

change Add_Date format

Quote Reply
change Add_Date format
Hi Andy,
I'm trying to change my <%Add_Date%> format in the xml results plugin to a date google accepts
At the moment <%Add_Date%> output looks like this
Code:
<pubDate>Dienstag, 24.01.2012</pubDate>

I think google wants something like this
Code:
2012-01-24

Do you have a solution for this?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] change Add_Date format In reply to
I tried it with
Code:
<pubDate><%GT::Date::date_transform($date,'%ddd%, %dd% %mmm% %yyyy%','%yyyy%-%mm%-%dd%')%></pubDate>

But there is no output at all? Crazy

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] change Add_Date format In reply to
I think you have it the wrong way. Here is what the docs say:

Code:
date_transform ($date, $orig_fmt, $new_fmt);

So try:

Code:
<pubDate><%GT::Date::date_transform($date,'%yyyy%-%mm%-%dd%','%ddd%, %dd% %mmm% %yyyy%')%></pubDate>

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] change Add_Date format In reply to
Hi Andy,
there is still no output.
Seems that $date does not work in that template...

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] change Add_Date format In reply to
If its Add_Date you wanna convert, you need to use $Add_Date, not $date Wink

Code:
<pubDate><%GT::Date::date_transform($Add_Date,'%yyyy%-%mm%-%dd%','%ddd%, %dd% %mmm% %yyyy%')%></pubDate>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] change Add_Date format In reply to
Hi Andy,
Code:
<%Add-Date%>
alone works fine
but
Code:
<%GT::Date::date_transform($Add_Date,'%yyyy%-%mm%-%dd%','%ddd%, %dd% %mmm% %yyyy%')%>

has no output Frown

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] change Add_Date format In reply to
If you format is (as in your first post);

Dienstag, 24.01.2012

Then you need something like:

Code:
<%GT::Date::date_transform($Add_Date,'%dddd%, %dd%.%mm%.%yyyy%','%ddd%, %dd% %mmm% %yyyy%')%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] change Add_Date format In reply to
Now I'm using this code. And it seems to work fine
Code:
<pubDate><%GT::Date::date_transform($Add_Date,'%dddd%, %dd%.%mm%.%yyyy%','%yyyy%-%mmm%-%dd%')%></pubDate>

Now I have this output
Code:
2012-01-28

Let's see what google says Wink

Thank you Andy

Matthias
gpaed.de
Quote Reply
Re: [Andy] change Add_Date format In reply to
Hi Andy,
now the date in my xml sitemap ist fine.

But know google has a problem with some characters like this
&[/url]

Is there a way to exclude this characters from link titles and descriptions?

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] change Add_Date format In reply to
Hi,

You would probably be best to just "encode" them.. for example:

Code:
<%GT::CGI::html_escape($Title)%>

..instead of just:

Code:
<%Title%>

This should change stuff like > to &gt; , & into &amp; etc

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] change Add_Date format In reply to
That's it.
Thanks Andy

Matthias
gpaed.de