<?xml version="1.0" encoding="windows-1252"?>
<node id="434177" title="strftime reference for Win32" created="2005-02-24 13:30:26" updated="2005-08-10 15:36:00">
<type id="120">
perlmeditation</type>
<author id="241598">
holli</author>
<data>
<field name="doctext">
The [Posix]-module has a very nice function called &lt;code&gt;strftime()&lt;/code&gt; that is capable of formatting dates and times to a human readable format.&lt;br&gt;&lt;br&gt;
But ... the manpage  is not very descriptive. It tells you nothing about the meanings of the parameters in the format string.&lt;br&gt;&lt;br&gt;
Unix/Linux users can read about them by typing
&lt;code&gt;
$ date --help
&lt;/code&gt;

(thanks [blokhead] for advising me on that), but Windows users are lost.
&lt;br&gt;&lt;br&gt;
Therefore, in the hope it will help somebody*, i post this little script, that can serve both as a reference and as an example.
&lt;code&gt;
use strict;
use POSIX qw(strftime);

print strftime qq{
a: Day of Week    (short, text) %a
A: Day of Week     (long, text) %A
b: Monthname      (short, text) %b
B: Monthname       (long, text) %B
c: Full datetime (number, long) %c
d: Day                 (number) %d
H: Hour (24 hour)      (number) %H
I: Hour (12 hour)      (number) %I
j: Day of year         (number) %j
m: Month               (number) %m
M: Minutes             (number) %M
p: am/pm/empty           (text) %p 
S: Seconds             (number) %S
U: Week of Year        (number) %U
w: Day of week         (number) %w
W: Week of Year        (number) %W
x: date                (number) %x
X: time                (number) %X
y: year         (short, number) %y
Y: year          (long, number) %Y
Z: timezone              (text) %Z
},
localtime;&lt;/code&gt;&lt;br&gt;
&lt;b&gt;Notes:&lt;/b&gt;&lt;br&gt;
The parameters %U and %W, are not identical. %U starts counting the Week Of Year at sundays, %W starts counting on mondays.&lt;br&gt;
The %p parameter can be empty, depending on the locale of the system.&lt;br&gt;&lt;br&gt;
*and for my own convenience
&lt;br&gt;&lt;br&gt;
Update: corrected typo for %M
&lt;br&gt;
Update: corrected typo for %I (thanks [bmann])
&lt;br&gt;
Update: retitled node from "strftime reference" to "strftime reference for win32"
&lt;div class="pmsig"&gt;&lt;div class="pmsig-241598"&gt;
&lt;br&gt;&lt;br&gt;holli, &lt;i&gt;/regexed monk/&lt;/i&gt;
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
