![]() If not, a new Date::Pcalendar::Year object is created using the profile that has been associated with the given calendar object. If the cache in the given calendar object already contains an object for the requested year, the corresponding object reference is simply returned. This method returns a Date::Pcalendar::Year object for the given year and the profile that was associated with the given calendar object. This calendar object is a caching proxy object it stores the reference of the given profile and contains a hash (the cache) of Date::Pcalendar::Year objects. The method creates a new calendar object for a given profile, i.e., a given location and its scheme of holidays (or a scheme of your own). #Date pcalc how to#See Date::Pcalendar::Profiles(3) and Date::Pcalendar::Year(3) for more details about these arguments and about how to roll your own calendar profiles. This can be used to switch off this feature and to have no regularly recurring holidays at all when for instance a zero is given. If values outside of the range 1.7 are given, they will be ignored. If no values are given, 6 and 7 (Saturday and Sunday) are automatically taken as default. The second argument is optional, and must consist of the valid name or number of a language as provided by the Date::Pcalc(3) module if given.Īfter the second argument, a list of day numbers which will constitute the "weekend" can optionally be specified, where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday and 7=Sunday. The first argument must be the reference of a hash, which contains a holiday scheme or "profile" to be used in all calculations involving the new calendar object. $calendar = Date::Pcalendar->new(PROFILE]) Moreover, whenever a method of this class returns a date, it does so by returning a Date::Pcalc date object. However, and perhaps against your expectations at times, especially in conjunction with the method "cache_add()", only the year number from that object will be used, not the year object itself (the year object in question might be using the wrong profile!). If you substitute an expected year number by an anonymous array (this is the recommended way of writing date constants, for increased readability of your programs), it must contain three values, nevertheless (otherwise the use of an anonymous array would be pointless).ĭon't confuse year numbers and their substitutes (a date object or an array reference) with Date::Pcalendar::Year objects, which are a totally different thing!īut incidentally :-), you may also pass a Date::Pcalendar::Year object whenever a year number is expected. $object->method3( $year1, $date2, ) Īnd similarly if a time or a combined date and time are expected. So instead of calling a given method like this: See Date::Pcalc::Object(3) for more details. Note that whenever a year number, a date, a time or a combined date and time are expected as input parameters by one of the methods of this class, you can always pass a Date::Pcalc date object or an array reference (of an array of appropriate length) instead! $flag = $calendar->is_work(YEAR,MONTH,DAY|DATE) INTERFACE $flag = $calendar->is_half(YEAR,MONTH,DAY|DATE) $flag = $calendar->is_full(YEAR,MONTH,DAY|DATE) $date = $calendar->add_delta_workdays(YEAR,MONTH,DAY|DATE ($date,$rest) = $calendar->add_delta_workdays(YEAR,MONTH,DAY|DATE $hashref = $calendar->tags(YEAR,MONTH,DAY|DATE) $year_2001_DE_SN = $calendar_DE_SN->year( 2001 = $calendar->cache_keys() # returns list of year = $calendar->cache_vals() # returns list of year objects $calendar_US_AZ = Date::Pcalendar->new( $Profiles-> ] ) Use Date::Pcalendar::Profiles qw( $Profiles ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |