1 |
3 |
ahitrov@rambler.ru |
% if( $showdate ) { |
2 |
|
|
<% $sdate %>\ |
3 |
|
|
% } |
4 |
|
|
% if( $showdate && $showtime ) { |
5 |
|
|
, \ |
6 |
|
|
% } |
7 |
|
|
% if( $showtime ) { |
8 |
|
|
<% $stime %>\ |
9 |
|
|
% } |
10 |
|
|
<%args> |
11 |
|
|
|
12 |
|
|
$datetime => undef |
13 |
|
|
|
14 |
|
|
$showyear => 1 |
15 |
|
|
$showdate => 1 |
16 |
|
|
$showtime => 0 |
17 |
|
|
|
18 |
|
|
$digital => 0 |
19 |
|
|
|
20 |
|
|
</%args> |
21 |
|
|
<%doc> |
22 |
|
|
|
23 |
|
|
��������� ���� � ������� yyyy-mm-dd[ mm:ss], ��� � ���� ����� ������ � ������ ������������ ���. |
24 |
|
|
|
25 |
|
|
���������� �� � ���� |
26 |
|
|
|
27 |
|
|
dd ��������_������ yyyy [hh:mm[:ss]] |
28 |
|
|
|
29 |
|
|
��� � ���� |
30 |
|
|
|
31 |
|
|
dd.mm.yyyy [hh:mm[:ss]] |
32 |
|
|
|
33 |
|
|
���� ����� �������� digital = 1 |
34 |
|
|
|
35 |
|
|
����� � ������������ ������ ����� ������������� ���, |
36 |
|
|
���� �������� $showyear = undef. |
37 |
|
|
|
38 |
|
|
���� �������� $showdate = undef, �� �������� ��������� $showyear �� ����� �������� |
39 |
|
|
|
40 |
|
|
</%doc> |
41 |
|
|
<%init> |
42 |
|
|
|
43 |
|
|
my ($y, $mon, $d, $hr, $mn); |
44 |
|
|
|
45 |
|
|
if ($datetime) |
46 |
|
|
{ |
47 |
|
|
$datetime =~ /(\d{4})-0?(\d{1,2})-0?(\d{1,2})\s*(\d{0,2}):*(\d{0,2})/; |
48 |
|
|
($y, $mon, $d, $hr, $mn) = ($1, $2, $3, $4, $5); |
49 |
|
|
} |
50 |
|
|
else |
51 |
|
|
{ |
52 |
|
|
($mn, $hr, $d, $mon, $y) = (localtime())[1 .. 5]; |
53 |
|
|
$mon++; $y += 1900; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
my $stime = sprintf( "%2.2d:%2.2d", $hr, $mn ); |
57 |
|
|
my $smon = (qw(������ ������� ����� ������ ��� ���� ���� ������� �������� ������� ������ �������))[$mon-1]; |
58 |
|
|
|
59 |
|
|
my $sdate = ($digital ? sprintf( "%2.2d.%2.2d", $d, $mon ) : sprintf( "%2.2d %s", $d, $smon ) ); |
60 |
|
|
if( $showyear ) |
61 |
|
|
{ |
62 |
|
|
$sdate .= ($digital ? '.' : ' ').$y; |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
</%init> |