Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to use 2 format of date ?

Quote Reply
How to use 2 format of date ?
Hi,

I have a problem with the format of date.

I use a foreign format of date for date_days_short and date_month_short.
But, I must also use the english format.

My question :

It is possible to obtain the English format without modifying the configuration of date_days_short and date_month_short ?
I would like to obtain for add_date : Wed, Oct. 02 2002 13:00: 00 GMT

Thanks for your assistance.

Mick

Quote Reply
Re: [MJ_] How to use 2 format of date ? In reply to
Sorry, not 100% sure what you are asking for?

Youi want 2 date formats ? (as globals)

Cheers

Andy

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] How to use 2 format of date ? In reply to
Hi Andy,

Currently, I obtain with my configuration of date : Jeu, Jan 29 2009 00:00:00 GMT

Code:
<%GT::Date::date_transform($Mod_Date, '%yyyy%-%mm%-%dd%', '%ddd%, %dd% %mmm% %yyyy% %HH%:%MM%:%ss%')%> GMT


But, I would like to obtain it in English : Thur, Jan 29 2009 00:00:00 GMT

And, I do not want to modify my configuration in Setup > Date Options > date_days_short and date_month_short.

You think that it is possible with a global ?

Thanks,

Mick

Last edited by:

MJ_: Jan 29, 2009, 7:26 AM
Quote Reply
Re: [MJ_] How to use 2 format of date ? In reply to
So you just really wanna change the "day" into "English" ?

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: [MJ_] How to use 2 format of date ? In reply to
Try this (not pretty, but should do what you want)

change_eng_day
Code:
sub {
my $in = $_[0];
$in =~ s/\QJeu/Thur/;
$in =~ s/\QVend/Fri/;
# for each day, just add another one of the above, I'm not good with french, so the above 1 may need editing :P
return $in;
}

Then call with:

Code:
<%set day_transformed = GT::Date::date_transform($Mod_Date, '%yyyy%-%mm%-%dd%', '%ddd%, %dd% %mmm% %yyyy% %HH%:%MM%:%ss%')%>
<%change_eng_day($day_transformed)%> GMT

Untested, but can't see why it wouldn't work :)

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] How to use 2 format of date ? In reply to
Yes, and month.

It is so that my RSS is valid.
validator.w3.org/feed/

An idea ?

Mick
Quote Reply
Re: [Andy] How to use 2 format of date ? In reply to
I can also add the months like this :

$in =~ s/\QJan/Jan/;
$in =~ s/\QFév/Feb/;

Thanks for your patience !

Mick
Quote Reply
Re: [MJ_] How to use 2 format of date ? In reply to
Yup :)

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] How to use 2 format of date ? In reply to
Thank you Andy, Smile

My file rss is perfectly valid now !

Mick
Quote Reply
Re: [MJ_] How to use 2 format of date ? In reply to
Good to hear Cool

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!