Show
Ignore:
Timestamp:
07/10/08 17:16:23 (17 months ago)
Author:
bchoate
Message:

Updated POD.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/lib/MT/DateTime.pm

    r1745 r2747  
    245245=head1 NAME 
    246246 
    247 MT::DateTime 
     247MT::DateTime - A utility package for handling date/time values for Movable 
     248Type. 
    248249 
    249250=head1 METHODS 
    250251 
     252=head2 MT::DateTime->new(%attr) 
     253 
     254Constructs a new C<MT::DateTime> object using the values in C<%attr>. 
     255C<%attr> may contain: 
     256 
     257=over 4 
     258 
     259=item * year 
     260 
     261A 4-digit year. 
     262 
     263=item * month 
     264 
     265Month number, where January is 0. 
     266 
     267=item * day 
     268 
     269Day number, from 1 to 31. 
     270 
     271=item * hour 
     272 
     273Hour in 24 hour notation (0-23). 
     274 
     275=item * minute 
     276 
     277Minutes (0-59). 
     278 
     279=item * second 
     280 
     281Seconds (0-59). 
     282 
     283=item * time_zone 
     284 
     285Timezone, in '+HH:MM', '-HH:MM', '+HH', or '-HH' notation. 
     286 
     287=back 
     288 
    251289=head2 compare( a => $a, b => $b, blog => $blog ) 
    252290 
    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' } ); 
     291Compares two timestamp strings and returns negative valye, 0, or 
     292positive value depending on whether the "a" argument is less than, 
     293equal to, or greater than the "b" argument. 
     294 
     295You can specify scalar value to "a" and "b".  They are treated as 
     296timestamp values (e.g. 20080405123456).  You can also specify either 
     297epoch string (e.g the string returned from time method), or C<MT::DateTime> 
     298object.  In those cases, you must specify both value and type in a hash, 
     299for example: 
     300 
     301    MT::DateTime->compare( blog => $blog, 
     302        a => '20041231123456', b => { value => time(), type => 'epoch' } ); 
     303 
     304=head2 $datetime->week_year() 
     305 
     306Returns the year for the start of the week for the object. 
     307 
     308=head2 $datetime->week_number() 
     309 
     310Returns the week number calculated for the object. 
     311 
     312=head2 $datetime->year() 
     313 
     314Returns the year component of the object. 
     315 
     316=head2 $datetime->month() 
     317 
     318Returns the month component of the object. 
     319 
     320=head2 $datetime->day() 
     321 
     322Returns the day component of the object. 
     323 
     324=head2 $datetime->hour() 
     325 
     326Returns the hours component of the object. 
     327 
     328=head2 $datetime->minute() 
     329 
     330Returns the minutes component of the object. 
     331 
     332=head2 $datetime->second() 
     333 
     334Returns the seconds component of the object. 
     335 
     336=head2 $datetime->time_zone() 
     337 
     338Returns the time zone component of the object. 
     339 
     340=head2 $datetime->day_of_year() 
     341 
     342Returns the day number of the year of the object. 
     343 
     344=head2 $datetime->week() 
     345 
     346Returns a list containing the year of the week (C<week_year>) and 
     347the week number (C<week_number>). 
     348 
     349=head2 MT::DateTime->weeks_in_year($year) 
     350 
     351Returns the number of weeks that are in the specified C<$year>. Returns 
     352either 52 or 53, depending on the year. 
     353 
     354=head2 $datetime->ymd2rd( [ $year, $month, $day ]) 
     355 
     356Converts the given C<$year>, C<$month>, C<$day> (or, if unspecified, 
     357uses the year, month, day elements from C<$datetime>) into a 'Rata Die' 
     358days value. 
     359 
     360=head2 $datetime->tz_offset_as_seconds( [$offset] ) 
     361 
     362Converts the given C<$offset> (or, if absent, uses the time_zone 
     363component of C<$datetime>) into an expression of seconds. I.e., 
     364an C<$offset> of '-1:30' would yield -5400. 
    264365 
    265366=head1 AUTHOR & COPYRIGHT