.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Template::Plugin::DateTime 3pm" .TH Template::Plugin::DateTime 3pm "2022-06-17" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Template::Plugin::DateTime \- A Template Plugin To Use DateTime Objects .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& [% USE date = DateTime(year = 2004, month = 4, day = 1) %] \& \& [% USE date = DateTime(today = 1) %] \& Today is [% date.year %]/[% date.month %]/[% date.day %]. \& [% date.add(days => 32) %] \& 32 days from today is [% date.year %]/[% date.month %]/[% date.day %]. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The basic idea to use a DateTime plugin is as follows: .PP .Vb 1 \& USE date = DateTime(year = 2004, month = 4, day = 1); .Ve .PP \&\-OR\- .PP by passing a pattern to parse a date by string using DateTime::Format::Strptime .PP .Vb 1 \& USE date = DateTime(from_string => \*(Aq2008\-05\-30 00:00:00\*(Aq, pattern => \*(Aq%Y\-%m\-%d %H:%M:%S\*(Aq, time_zone => \*(AqAmerica/New_York\*(Aq); .Ve .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" This is used internally. You won't be using it from your templates. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" The constructor is exactly the same as that of Datetime.pm, except you can pass optional parameters to it to toggle between different underlying DateTime constructors. .IP "from_epoch" 4 .IX Item "from_epoch" Creates a Datetime object by calling \fBDateTime::from_epoch()\fR. The value for the from_epoch parameter must be a number representing \s-1UNIX\s0 epoch. .Sp .Vb 2 \& [% epoch = ... %] \& [% USE date = DateTime(from_epoch = epoch) %] .Ve .IP "now" 4 .IX Item "now" Creates a DateTime object by calling \fBDateTime::now()\fR. The value for the c parameter is a boolean value. .Sp .Vb 2 \& [% USE date = DateTime(now = 1) %] \& [% USE date = Datetime(now = 1, time_zone => \*(AqAsia/Tokyo\*(Aq) %] .Ve .IP "today" 4 .IX Item "today" Creates a DateTime object by calling \fBDateTime::today()\fR. The value for the c parameter is a boolean value. .Sp .Vb 1 \& [% USE date = DateTime(today = 1) %] .Ve .IP "from_object" 4 .IX Item "from_object" Creates a DateTime object by calling \fBDateTime::from_object()\fR. The value for the from_object must be an object implementing the \fButc_rd_values()\fR method, as described in DateTime.pm .Sp .Vb 1 \& [% USE date = DateTime(from_object = other_date) %] .Ve .IP "last_day_of_month" 4 .IX Item "last_day_of_month" Creates a DateTime object by calling \fBDateTime::last_day_of_month()\fR. The value for the c parameter is a boolean value, and \f(CW\*(C`year\*(C'\fR and \f(CW\*(C`month\*(C'\fR parameters must be specified. .Sp .Vb 1 \& [% USE date = DateTime(last_day_of_month = 1, year = 2004, month = 4 ) %] .Ve .IP "from_string" 4 .IX Item "from_string" Creates a DateTime object by calling DateTime::Format::Strptime The value for the c parameter is a string value, and \f(CW\*(C`pattern\*(C'\fR parameters is optional and defaults to '%Y\-%m\-%d \f(CW%H:\fR%M:%S'. See DateTime::Format::Strptime for other optional parameters. .Sp .Vb 1 \& [% USE date = DateTime(from_string => \*(Aq2008\-05\-30 10:00:00\*(Aq, pattern => \*(Aq%Y\-%m\-%d %H:%M:%S\*(Aq) %] .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" DateTime DateTime::Format::Strptime Template .SH "AUTHOR" .IX Header "AUTHOR" Copyright (c) 2004\-2007 Daisuke Maki . .SH "LICENSE" .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See http://www.perl.com/perl/misc/Artistic.html