0

I want to display the week number and the day with the date plugin in Template-toolkit. The output for today would be something like:

36 Monday

I got the week number with the following code:

[% USE date(format = '%W' ) %]
[% date.format %]

Still trying to figure out how to get the weekday.

Twistar
  • 782
  • 5
  • 21
  • 35
  • It looks like you expect us to jump to your call and write the code for you, but Stack Overflow isn't like that. When you post a question here you are expected to have tried your very best to fix a coding problem and failed. Please show us what you have written and describe the obstacle that is preventing you from progressing – Borodin Sep 03 '12 at 10:45
  • Did you look at the documentation on CPAN ? It is complete with a lot of examples. – Éric Guirbal Sep 03 '12 at 10:49
  • @Borodin I have been looking at http://template-toolkit.org/docs/modules/Template/Plugin/Date.html for how to do this. I have also been searching on Google to find some examples. I have code for displaying today's date but that code is in no way relevant to my question. – Twistar Sep 03 '12 at 11:00
  • The first sentence of the description of the Date plugin is: "The Date plugin provides an easy way to generate formatted time and date strings by delegating to the POSIX strftime() routine." You can find strftime format info here: http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html – martin clayton Sep 03 '12 at 12:03
  • There isn't a "the week number"; there are several significantly different ways to count weeks. strftime, and hence Template::Plugin::Date, usually supports three of them (%U, %V, and %W), but there are others. – ysth Sep 03 '12 at 23:47

1 Answers1

6

From http://template-toolkit.org/docs/modules/Template/Plugin/Date.html

The Date plugin provides an easy way to generate formatted time and date strings by delegating to the POSIX strftime() routine.

From http://perldoc.perl.org/POSIX.html#strftime

Consult your system's strftime() manpage for details about these and the other arguments.

From http://linux.die.net/man/3/strftime

%A The full weekday name according to the current locale.

Chas. Owens
  • 64,182
  • 22
  • 135
  • 226