Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Date format
getnaren
I have <iw_value name="newsitem2.date"/> which givs date like this: 06/29/2005
I need to make it 6 Juni 2005 this is for a german page... I have names for the 12 months in germany....how can I get this work in presentation template?
Find more posts tagged with
Comments
nipper
perldoc Date::Manip is a start
Do not know if it will translate
TableBorderProblem2.zip
jkm
you can try something of Date::Manip package
&Date_Init("Language=German","DateFormat=non-US");
and then perform the normal operations
Adam Stoller
Switch to using perl for your PTs - you'll find it much easier (after the initial learning curve perhaps) to manipulate the data you're retrieving from your DCRs.
If need be - break out into perl within your XML style PT with something like:
...
<iw_perl>
my
@dateval
= split('/', iwpt_dcr_value('newsitem2.date'));
my $mon = get_locale_month($dateval[0]);
iwpt_output(join(q{ },
@dateval[1
,0,2]));
</iw_perl>
...
Where you define and use your own subroutine (here called
get_locale_month
)
(note: your posted example translated 6/29/2005 to 6 Juni 2005 instead of
29
Juni 2005)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
getnaren
did u write the code for that subroutine...please send
getnaren
sorry,
I had made a typo 6/29/2005 is the date and I need it to dispaly 29 Juni 2005
These are the month names
Januar
Februar
März
April
Mai
Juni
Edited by getnaren on 10/14/05 12:02 PM (server time).
Adam Stoller
No - I didn't write any such routine - I assumed (perhaps incorrectly) that you had already created such a routine.
It's trivial to do if you already have the month names - otherwise - Data::Manip is probably a reasonable way to go.
In either case - you need to write code - if you're not comfortable doing so - you either need to "get" comfortable - or bring someone else in to do it for you.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Bill Klish
We ended up using Java, as the Perl date manipulation module did not handle double byte languages very well, calling the Java class directly from the PT inside of a <iw-perl> block.
getnaren
Hi here is my sub
<iw_perl>
<![CDATA[
sub processDate
{
my ($d, $m, $y) = split('\/', $_[0];
$y = $y+2000;
$d =~ s/^0//; # strip leading zero
# german months hash
$mn{'01'} = "Januar";
$mn{'02'} = "Februar";
$mn{'03'} = "März";
$mn{'04'} = "April";
$mn{'05'} = "Mai";
$mn{'06'} = "Juni";
$mn{'07'} = "Juli";
$mn{'08'} = "August";
$mn{'09'} = "September";
$mn{'10'} = "Oktober";
$mn{'11'} = "November";
$mn{'12'} = "Dezember";
my $out = $d." $mn{$m} ".$y;
return($out);
}
]]>
</iw_perl>
how can I use tthat with ur code?
<iw_perl>
my
@dateval
= split('/', iwpt_dcr_value('newsitem2.date'));
my $mon = processDate($dateval[0]);
iwpt_output(join(q{ },
@dateval[1
,0,2]));
</iw_perl>
Adam Stoller
My bad - It should have been:
<iw_perl>
my
@dateval
= split('/', iwpt_dcr_value('newsitem2.date'));
my
$dateval[0]
= processDate($dateval[0]);
iwpt_output(join(q{ },
@dateval[1
,0,2]));
</iw_perl>
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
gzevin
From the doc of Date::Manip:
Language
Date::Manip can be used to parse dates in many different languages. Currently, it is configured to read the following languages (the version in which they added is included for historical interest):
English (default)
French (5.02)
Swedish (5.05)
German (5.31)
Dutch (5.32) aka Nederlands
Polish (5.32)
Spanish (5.33)
Portuguese (5.34)
Romanian (5.35)
Italian (5.35)
Russian (5.41)
Turkish (5.41)
Danish (5.41)
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU