/usr/share/doc/rt4-doc-html/RT/Date.html is in rt4-doc-html 4.0.19-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | <ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#METHODS">METHODS</a>
<ul>
<li><a href="#new">new</a></li>
<li><a href="#Set">Set</a></li>
<li><a href="#SetToNow">SetToNow</a></li>
<li><a href="#SetToMidnight-Timezone-utc">SetToMidnight [Timezone => 'utc']</a></li>
<li><a href="#Diff">Diff</a></li>
<li><a href="#DiffAsString">DiffAsString</a></li>
<li><a href="#DurationAsString">DurationAsString</a></li>
<li><a href="#AgeAsString">AgeAsString</a></li>
<li><a href="#AsString">AsString</a></li>
<li><a href="#GetWeekday-DAY">GetWeekday DAY</a></li>
<li><a href="#GetMonth-MONTH">GetMonth MONTH</a></li>
<li><a href="#AddSeconds-SECONDS">AddSeconds SECONDS</a></li>
<li><a href="#AddDays-DAYS">AddDays [DAYS]</a></li>
<li><a href="#AddDay">AddDay</a></li>
<li><a href="#Unix-unixtime">Unix [unixtime]</a></li>
<li><a href="#DateTime">DateTime</a></li>
<li><a href="#Date">Date</a></li>
<li><a href="#Time">Time</a></li>
<li><a href="#Get">Get</a></li>
<li><a href="#Output-formatters">Output formatters</a>
<ul>
<li><a href="#Formatters">Formatters</a></li>
<li><a href="#ValidFormatter-FORMAT">ValidFormatter FORMAT</a></li>
<li><a href="#DefaultFormat">DefaultFormat</a></li>
</ul>
</li>
<li><a href="#LocaleObj">LocaleObj</a>
<ul>
<li><a href="#LocalizedDateTime">LocalizedDateTime</a></li>
<li><a href="#ISO">ISO</a></li>
<li><a href="#W3CDTF">W3CDTF</a></li>
<li><a href="#RFC2822-MIME">RFC2822 (MIME)</a></li>
<li><a href="#RFC2616-HTTP">RFC2616 (HTTP)</a>
<ul>
<li><a href="#iCal">iCal</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Timezones-handling">Timezones handling</a>
<ul>
<li><a href="#Localtime-context-time">Localtime $context [$time]</a></li>
<li><a href="#Timelocal-context-time">Timelocal $context @time</a></li>
<li><a href="#Timezone-context">Timezone $context</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="NAME"><a href="#___top">NAME</a></h1>
<pre><code> RT::Date - a simple Object Oriented date.</code></pre>
<h1 id="SYNOPSIS"><a href="#___top">SYNOPSIS</a></h1>
<pre><code> use RT::Date</code></pre>
<h1 id="DESCRIPTION"><a href="#___top">DESCRIPTION</a></h1>
<p>RT Date is a simple Date Object designed to be speedy and easy for RT to use</p>
<p>The fact that it assumes that a time of 0 means "never" is probably a bug.</p>
<h1 id="METHODS"><a href="#___top">METHODS</a></h1>
<h2 id="new"><a href="#___top">new</a></h2>
<p>Object constructor takes one argument <code>RT::CurrentUser</code> object.</p>
<h2 id="Set"><a href="#___top">Set</a></h2>
<p>Takes a param hash with the fields <code>Format</code>, <code>Value</code> and <code>Timezone</code>.</p>
<p>If $args->{'Format'} is 'unix', takes the number of seconds since the epoch.</p>
<p>If $args->{'Format'} is ISO, tries to parse an ISO date.</p>
<p>If $args->{'Format'} is 'unknown', require Time::ParseDate and make it figure things out. This is a heavyweight operation that should never be called from within RT's core. But it's really useful for something like the textbox date entry where we let the user do whatever they want.</p>
<p>If $args->{'Value'} is 0, assumes you mean never.</p>
<h2 id="SetToNow"><a href="#___top">SetToNow</a></h2>
<p>Set the object's time to the current time. Takes no arguments and returns unix time.</p>
<h2 id="SetToMidnight-Timezone-utc"><a href="#___top">SetToMidnight [Timezone => 'utc']</a></h2>
<p>Sets the date to midnight (at the beginning of the day). Returns the unixtime at midnight.</p>
<p>Arguments:</p>
<dl>
<dt id="Timezone">Timezone</dt>
<dd>
<p>Timezone context <code>user</code>, <code>server</code> or <code>UTC</code>. See also <a href="#Timezone">"Timezone"</a>.</p>
</dd>
</dl>
<h2 id="Diff"><a href="#___top">Diff</a></h2>
<p>Takes either an <code>RT::Date</code> object or the date in unixtime format as a string, if nothing is specified uses the current time.</p>
<p>Returns the differnce between the time in the current object and that time as a number of seconds. Returns <code>undef</code> if any of two compared values is incorrect or not set.</p>
<h2 id="DiffAsString"><a href="#___top">DiffAsString</a></h2>
<p>Takes either an <code>RT::Date</code> object or the date in unixtime format as a string, if nothing is specified uses the current time.</p>
<p>Returns the differnce between <code>$self</code> and that time as a number of seconds as a localized string fit for human consumption. Returns empty string if any of two compared values is incorrect or not set.</p>
<h2 id="DurationAsString"><a href="#___top">DurationAsString</a></h2>
<p>Takes a number of seconds. Returns a localized string describing that duration.</p>
<h2 id="AgeAsString"><a href="#___top">AgeAsString</a></h2>
<p>Takes nothing. Returns a string that's the differnce between the time in the object and now.</p>
<h2 id="AsString"><a href="#___top">AsString</a></h2>
<p>Returns the object's time as a localized string with curent user's prefered format and timezone.</p>
<p>If the current user didn't choose prefered format then system wide setting is used or <a href="#DefaultFormat">"DefaultFormat"</a> if the latter is not specified. See config option <code>DateTimeFormat</code>.</p>
<h2 id="GetWeekday-DAY"><a href="#___top">GetWeekday DAY</a></h2>
<p>Takes an integer day of week and returns a localized string for that day of week. Valid values are from range 0-6, Note that <b>0 is sunday</b>.</p>
<h2 id="GetMonth-MONTH"><a href="#___top">GetMonth MONTH</a></h2>
<p>Takes an integer month and returns a localized string for that month. Valid values are from from range 0-11.</p>
<h2 id="AddSeconds-SECONDS"><a href="#___top">AddSeconds SECONDS</a></h2>
<p>Takes a number of seconds and returns the new unix time.</p>
<p>Negative value can be used to substract seconds.</p>
<h2 id="AddDays-DAYS"><a href="#___top">AddDays [DAYS]</a></h2>
<p>Adds <code>24 hours * DAYS</code> to the current time. Adds one day when no argument is specified. Negative value can be used to substract days.</p>
<p>Returns new unix time.</p>
<h2 id="AddDay"><a href="#___top">AddDay</a></h2>
<p>Adds 24 hours to the current time. Returns new unix time.</p>
<h2 id="Unix-unixtime"><a href="#___top">Unix [unixtime]</a></h2>
<p>Optionally takes a date in unix seconds since the epoch format. Returns the number of seconds since the epoch</p>
<h2 id="DateTime"><a href="#___top">DateTime</a></h2>
<p>Alias for <a href="#Get">"Get"</a> method. Arguments <code>Date</code> and <Time> are fixed to true values, other arguments could be used as described in <a href="#Get">"Get"</a>.</p>
<h2 id="Date"><a href="#___top">Date</a></h2>
<p>Takes Format argument which allows you choose date formatter. Pass throught other arguments to the formatter method.</p>
<p>Returns the object's formatted date. Default formatter is ISO.</p>
<h2 id="Time"><a href="#___top">Time</a></h2>
<h2 id="Get"><a href="#___top">Get</a></h2>
<p>Returnsa a formatted and localized string that represets time of the current object.</p>
<h2 id="Output-formatters"><a href="#___top">Output formatters</a></h2>
<p>Fomatter is a method that returns date and time in different configurable format.</p>
<p>Each method takes several arguments:</p>
<dl>
<dt id="Date1">Date</dt>
<dd>
</dd>
<dt id="Time1">Time</dt>
<dd>
</dd>
<dt id="Timezone---Timezone-context-server-user-or-UTC">Timezone - Timezone context <code>server</code>, <code>user</code> or <code>UTC</code></dt>
<dd>
</dd>
</dl>
<p>Formatters may also add own arguments to the list, for example in RFC2822 format day of time in output is optional so it understand boolean argument <code>DayOfTime</code>.</p>
<h3 id="Formatters"><a href="#___top">Formatters</a></h3>
<p>Returns an array of available formatters.</p>
<h3 id="ValidFormatter-FORMAT"><a href="#___top">ValidFormatter FORMAT</a></h3>
<p>Returns a true value if <code>FORMAT</code> is a known formatter. Otherwise returns false.</p>
<h3 id="DefaultFormat"><a href="#___top">DefaultFormat</a></h3>
<h2 id="LocaleObj"><a href="#___top">LocaleObj</a></h2>
<p>Returns the <a href="http://metacpan.org/module/DateTime::Locale">DateTime::Locale</a> object representing the current user's locale.</p>
<h3 id="LocalizedDateTime"><a href="#___top">LocalizedDateTime</a></h3>
<p>Returns date and time as string, with user localization.</p>
<p>Supports arguments: <code>DateFormat</code> and <code>TimeFormat</code> which may contains date and time format as specified in <a href="http://metacpan.org/module/DateTime::Locale">DateTime::Locale</a> (default to full_date_format and medium_time_format), <code>AbbrDay</code> and <code>AbbrMonth</code> which may be set to 0 if you want full Day/Month names instead of abbreviated ones.</p>
<h3 id="ISO"><a href="#___top">ISO</a></h3>
<p>Returns the object's date in ISO format <code>YYYY-MM-DD mm:hh:ss</code>. ISO format is locale independant, but adding timezone offset info is not implemented yet.</p>
<p>Supports arguments: <code>Timezone</code>, <code>Date</code>, <code>Time</code> and <code>Seconds</code>. See </Output formatters> for description of arguments.</p>
<h3 id="W3CDTF"><a href="#___top">W3CDTF</a></h3>
<p>Returns the object's date and time in W3C date time format (<a href="http://www.w3.org/TR/NOTE-datetime">http://www.w3.org/TR/NOTE-datetime</a>).</p>
<p>Format is locale independand and is close enought to ISO, but note that date part is <b>not optional</b> and output string has timezone offset mark in <code>[+-]hh:mm</code> format.</p>
<p>Supports arguments: <code>Timezone</code>, <code>Time</code> and <code>Seconds</code>. See </Output formatters> for description of arguments.</p>
<h3 id="RFC2822-MIME"><a href="#___top">RFC2822 (MIME)</a></h3>
<p>Returns the object's date and time in RFC2822 format, for example <code>Sun, 06 Nov 1994 08:49:37 +0000</code>. Format is locale independand as required by RFC. Time part always has timezone offset in digits with sign prefix.</p>
<p>Supports arguments: <code>Timezone</code>, <code>Date</code>, <code>Time</code>, <code>DayOfWeek</code> and <code>Seconds</code>. See </Output formatters> for description of arguments.</p>
<h3 id="RFC2616-HTTP"><a href="#___top">RFC2616 (HTTP)</a></h3>
<p>Returns the object's date and time in RFC2616 (HTTP/1.1) format, for example <code>Sun, 06 Nov 1994 08:49:37 GMT</code>. While the RFC describes version 1.1 of HTTP, but the same form date can be used in version 1.0.</p>
<p>Format is fixed length, locale independand and always represented in GMT what makes it quite useless for users, but any date in HTTP transfers must be presented using this format.</p>
<pre><code> HTTP-date = rfc1123 | ...
rfc1123 = wkday "," SP date SP time SP "GMT"
date = 2DIGIT SP month SP 4DIGIT
; day month year (e.g., 02 Jun 1982)
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
; 00:00:00 - 23:59:59
wkday = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun"
| "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"</code></pre>
<p>Supports arguments: <code>Date</code> and <code>Time</code>, but you should use them only for some personal reasons, RFC2616 doesn't define any optional parts. See </Output formatters> for description of arguments.</p>
<h4 id="iCal"><a href="#___top">iCal</a></h4>
<p>Returns the object's date and time in iCalendar format,</p>
<p>Supports arguments: <code>Date</code> and <code>Time</code>. See </Output formatters> for description of arguments.</p>
<h2 id="Timezones-handling"><a href="#___top">Timezones handling</a></h2>
<h3 id="Localtime-context-time"><a href="#___top">Localtime $context [$time]</a></h3>
<p>Takes one mandatory argument <code>$context</code>, which determines whether we want "user local", "system" or "UTC" time. Also, takes optional argument unix <code>$time</code>, default value is the current unix time.</p>
<p>Returns object's date and time in the format provided by perl's builtin functions <code>localtime</code> and <code>gmtime</code> with two exceptions:</p>
<p>1) "Year" is a four-digit year, rather than "years since 1900"</p>
<p>2) The last element of the array returned is <code>offset</code>, which represents timezone offset against <code>UTC</code> in seconds.</p>
<h3 id="Timelocal-context-time"><a href="#___top">Timelocal $context @time</a></h3>
<p>Takes argument <code>$context</code>, which determines whether we should treat <code>@time</code> as "user local", "system" or "UTC" time.</p>
<p><code>@time</code> is array returned by <a href="http://metacpan.org/module/Localtime">Localtime</a> functions. Only first six elements are mandatory - $sec, $min, $hour, $mday, $mon and $year. You may pass $wday, $yday and $isdst, these are ignored.</p>
<p>If you pass <code>$offset</code> as ninth argument, it's used instead of <code>$context</code>. It's done such way as code <code>$self-</code>Timelocal('utc', $self->Localtime('server'))> doesn't makes much sense and most probably would produce unexpected result, so the method ignore 'utc' context and uses offset returned by <a href="http://metacpan.org/module/Localtime">Localtime</a> method.</p>
<h3 id="Timezone-context"><a href="#___top">Timezone $context</a></h3>
<p>Returns the timezone name.</p>
<p>Takes one argument, <code>$context</code> argument which could be <code>user</code>, <code>server</code> or <code>utc</code>.</p>
<dl>
<dt id="user">user</dt>
<dd>
<p>Default value is <code>user</code> that mean it returns current user's Timezone value.</p>
</dd>
<dt id="server">server</dt>
<dd>
<p>If context is <code>server</code> it returns value of the <code>Timezone</code> RT config option.</p>
</dd>
<dt id="utc">utc</dt>
<dd>
<p>If both server's and user's timezone names are undefined returns 'UTC'.</p>
</dd>
</dl>
<a href="./../">← Back to index</a>
|