| 253 | | Compares two timestamp strings and returns negative valye, 0, or positive value |
| 254 | | depending on whether the "a" argument is less than, equal to, or greater than |
| 255 | | the "b" argument. |
| 256 | | |
| 257 | | You can specify scalar value to "a" and "b". They are treated as timestamp values |
| 258 | | (e.g. 20080405123456). You can also specify either epoch string (e.g the string |
| 259 | | returned from time method), or MT::DateTime object. In those cases, you must |
| 260 | | specify both value and type in a hash, for example: |
| 261 | | |
| 262 | | MT::DateTime->compare( blog => $blog, |
| 263 | | a => '20041231123456', b => { value => time(), type => 'epoch' } ); |
| | 291 | Compares two timestamp strings and returns negative valye, 0, or |
| | 292 | positive value depending on whether the "a" argument is less than, |
| | 293 | equal to, or greater than the "b" argument. |
| | 294 | |
| | 295 | You can specify scalar value to "a" and "b". They are treated as |
| | 296 | timestamp values (e.g. 20080405123456). You can also specify either |
| | 297 | epoch string (e.g the string returned from time method), or C<MT::DateTime> |
| | 298 | object. In those cases, you must specify both value and type in a hash, |
| | 299 | for example: |
| | 300 | |
| | 301 | MT::DateTime->compare( blog => $blog, |
| | 302 | a => '20041231123456', b => { value => time(), type => 'epoch' } ); |
| | 303 | |
| | 304 | =head2 $datetime->week_year() |
| | 305 | |
| | 306 | Returns the year for the start of the week for the object. |
| | 307 | |
| | 308 | =head2 $datetime->week_number() |
| | 309 | |
| | 310 | Returns the week number calculated for the object. |
| | 311 | |
| | 312 | =head2 $datetime->year() |
| | 313 | |
| | 314 | Returns the year component of the object. |
| | 315 | |
| | 316 | =head2 $datetime->month() |
| | 317 | |
| | 318 | Returns the month component of the object. |
| | 319 | |
| | 320 | =head2 $datetime->day() |
| | 321 | |
| | 322 | Returns the day component of the object. |
| | 323 | |
| | 324 | =head2 $datetime->hour() |
| | 325 | |
| | 326 | Returns the hours component of the object. |
| | 327 | |
| | 328 | =head2 $datetime->minute() |
| | 329 | |
| | 330 | Returns the minutes component of the object. |
| | 331 | |
| | 332 | =head2 $datetime->second() |
| | 333 | |
| | 334 | Returns the seconds component of the object. |
| | 335 | |
| | 336 | =head2 $datetime->time_zone() |
| | 337 | |
| | 338 | Returns the time zone component of the object. |
| | 339 | |
| | 340 | =head2 $datetime->day_of_year() |
| | 341 | |
| | 342 | Returns the day number of the year of the object. |
| | 343 | |
| | 344 | =head2 $datetime->week() |
| | 345 | |
| | 346 | Returns a list containing the year of the week (C<week_year>) and |
| | 347 | the week number (C<week_number>). |
| | 348 | |
| | 349 | =head2 MT::DateTime->weeks_in_year($year) |
| | 350 | |
| | 351 | Returns the number of weeks that are in the specified C<$year>. Returns |
| | 352 | either 52 or 53, depending on the year. |
| | 353 | |
| | 354 | =head2 $datetime->ymd2rd( [ $year, $month, $day ]) |
| | 355 | |
| | 356 | Converts the given C<$year>, C<$month>, C<$day> (or, if unspecified, |
| | 357 | uses the year, month, day elements from C<$datetime>) into a 'Rata Die' |
| | 358 | days value. |
| | 359 | |
| | 360 | =head2 $datetime->tz_offset_as_seconds( [$offset] ) |
| | 361 | |
| | 362 | Converts the given C<$offset> (or, if absent, uses the time_zone |
| | 363 | component of C<$datetime>) into an expression of seconds. I.e., |
| | 364 | an C<$offset> of '-1:30' would yield -5400. |