Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Date display in presentation template file
System
new to templating. I captured against "Publish date" text field a date in the format of "MM-DD-YYYY". I am not good at complicated regular expressions. Is it too difficult to accomplish this? Is it possible to display using <iw-case> tag in the presentation template the above .
any code examples how to accomplish this please?
thank you
Find more posts tagged with
Comments
RichieRich
Are you looking to enforce the MM-DD-YYYY format in the datacapture field or are you trying to take the current time and display it in this format within the tpl?
If you are trying to format the current date in that format withing the TPL then try the following:
<iw_perl><![CDATA[
my $Fixed_Year;
($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time);
if($Year >= 100) {
$Fixed_Year = $Year + 1900;
}else{
$Fixed_Year = $Year;
}
iwpt_output("$Month-$Day-$Fixed_Year");
]]>
</iw_perl>
http://teamsitewebserver/iw/help/tst/pt/TeamSite__PT__iw_perl.html
Enjoy,
-[ Richie Rich ]-
Migrateduser
thanks for the reply. I have enforced the user to enter the date in the format of MM-DD-YYYY.
and in the presentation template I want to basically write code (using PT tags since I don't know Perl language) that if the user entered 01 (in DCR) then show "January" in the output file.
is it possible. bottomline I want to display the date as January 12 2002. any ideas please.
RichieRich
You can use a if case in perl within your tpl file Or if you don't want to use any perl code think about changing your datacapture.cfg file to have the user select the Month from a drop down has well as the day and year. If you're worried about the look of the Template capture field you can also make these fields show on the same line.
I hope this helps.
-[ Richie Rich ]-
Migrateduser
thank you. per ur suggestion, I created combo boxes and loaded, months, days and years.
works fine
regards