Package apple.foundation
Class NSCalendar
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.foundation.NSCalendar
-
- All Implemented Interfaces:
NSCoding,NSCopying,NSSecureCoding,NSObject
public class NSCalendar extends NSObject implements NSCopying, NSSecureCoding
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNSCalendar.Block_enumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNSCalendar(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean_supportsSecureCoding()This property must return YES on all classes that allow secure coding.static booleanaccessInstanceVariablesDirectly()static NSCalendaralloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)java.lang.StringAMSymbol()static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static NSCalendarautoupdatingCurrentCalendar()tracks changes to user's preferred calendar identifierjava.lang.StringcalendarIdentifier()static NSCalendarcalendarWithIdentifier(java.lang.String calendarIdentifierConstant)This method returns a new autoreleased calendar object of the given type, specified by a calendar identifier constant.static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()longcompareDateToDateToUnitGranularity(NSDate date1, NSDate date2, long unit)This API compares the given dates down to the given unit, reporting them equal if they are the same in the given unit and all larger units, otherwise either less than or greater than.longcomponentFromDate(long unit, NSDate date)Get just one component's value.NSDateComponentscomponentsFromDate(long unitFlags, NSDate date)NSDateComponentscomponentsFromDateComponentsToDateComponentsOptions(long unitFlags, NSDateComponents startingDateComp, NSDateComponents resultDateComp, long options)This API returns the difference between two dates specified as date components.NSDateComponentscomponentsFromDateToDateOptions(long unitFlags, NSDate startingDate, NSDate resultDate, long opts)NSDateComponentscomponentsInTimeZoneFromDate(NSTimeZone timezone, NSDate date)This API returns all the date components of a date, as if in a given time zone (instead of the receiving calendar's time zone).java.lang.ObjectcopyWithZone(org.moe.natj.general.ptr.VoidPtr zone)static NSCalendarcurrentCalendar()user's preferred calendarNSDatedateByAddingComponentsToDateOptions(NSDateComponents comps, NSDate date, long opts)NSDatedateByAddingUnitValueToDateOptions(long unit, long value, NSDate date, long options)This API returns a new NSDate object representing the date calculated by adding an amount of a specific component to a given date.NSDatedateBySettingHourMinuteSecondOfDateOptions(long h, long m, long s, NSDate date, long opts)This API returns a new NSDate object representing the date calculated by setting hour, minute, and second to a given time.NSDatedateBySettingUnitValueOfDateOptions(long unit, long v, NSDate date, long opts)This API returns a new NSDate object representing the date calculated by setting a specific component to a given time, and trying to keep lower components the same.NSDatedateFromComponents(NSDateComponents comps)booleandateMatchesComponents(NSDate date, NSDateComponents components)This API returns YES if the date has all the matched components.NSDatedateWithEraYearForWeekOfYearWeekOfYearWeekdayHourMinuteSecondNanosecond(long eraValue, long yearValue, long weekValue, long weekdayValue, long hourValue, long minuteValue, long secondValue, long nanosecondValue)Create a date with given components.NSDatedateWithEraYearMonthDayHourMinuteSecondNanosecond(long eraValue, long yearValue, long monthValue, long dayValue, long hourValue, long minuteValue, long secondValue, long nanosecondValue)Create a date with given components.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidencodeWithCoder(NSCoder coder)voidenumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock(NSDate start, NSDateComponents comps, long opts, NSCalendar.Block_enumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock block)This method computes the dates which match (or most closely match) a given set of components, and calls the block once for each of them, until the enumeration is stopped.NSArray<java.lang.String>eraSymbols()Methods to return component name strings localized to the calendar's localelongfirstWeekday()voidgetEraYearForWeekOfYearWeekOfYearWeekdayFromDate(org.moe.natj.general.ptr.NIntPtr eraValuePointer, org.moe.natj.general.ptr.NIntPtr yearValuePointer, org.moe.natj.general.ptr.NIntPtr weekValuePointer, org.moe.natj.general.ptr.NIntPtr weekdayValuePointer, NSDate date)This API is a convenience for getting era, year for week-of-year calculations, week of year, and weekday of a given date.voidgetEraYearMonthDayFromDate(org.moe.natj.general.ptr.NIntPtr eraValuePointer, org.moe.natj.general.ptr.NIntPtr yearValuePointer, org.moe.natj.general.ptr.NIntPtr monthValuePointer, org.moe.natj.general.ptr.NIntPtr dayValuePointer, NSDate date)This API is a convenience for getting era, year, month, and day of a given date.voidgetHourMinuteSecondNanosecondFromDate(org.moe.natj.general.ptr.NIntPtr hourValuePointer, org.moe.natj.general.ptr.NIntPtr minuteValuePointer, org.moe.natj.general.ptr.NIntPtr secondValuePointer, org.moe.natj.general.ptr.NIntPtr nanosecondValuePointer, NSDate date)This API is a convenience for getting hour, minute, second, and nanoseconds of a given date.static longhash_static()NSCalendarinit()NSCalendarinitWithCalendarIdentifier(java.lang.String ident)NSCalendarinitWithCoder(NSCoder coder)NS_DESIGNATED_INITIALIZERstatic NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)booleanisDateEqualToDateToUnitGranularity(NSDate date1, NSDate date2, long unit)This API compares the given dates down to the given unit, reporting them equal if they are the same in the given unit and all larger units.booleanisDateInSameDayAsDate(NSDate date1, NSDate date2)This API compares the Days of the given dates, reporting them equal if they are in the same Day.booleanisDateInToday(NSDate date)This API reports if the date is within "today".booleanisDateInTomorrow(NSDate date)This API reports if the date is within "tomorrow".booleanisDateInWeekend(NSDate date)This API reports if the date is within a weekend period, as defined by the calendar and calendar's locale.booleanisDateInYesterday(NSDate date)This API reports if the date is within "yesterday".static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)NSLocalelocale()NSArray<java.lang.String>longEraSymbols()NSRangemaximumRangeOfUnit(long unit)longminimumDaysInFirstWeek()NSRangeminimumRangeOfUnit(long unit)Calendrical calculationsNSArray<java.lang.String>monthSymbols()static java.lang.Objectnew_objc()NSDatenextDateAfterDateMatchingComponentsOptions(NSDate date, NSDateComponents comps, long options)This method computes the next date which matches (or most closely matches) a given set of components.NSDatenextDateAfterDateMatchingHourMinuteSecondOptions(NSDate date, long hourValue, long minuteValue, long secondValue, long options)This API returns a new NSDate object representing the date found which matches the given hour, minute, and second values.NSDatenextDateAfterDateMatchingUnitValueOptions(NSDate date, long unit, long value, long options)This API returns a new NSDate object representing the date found which matches a specific component value.booleannextWeekendStartDateIntervalOptionsAfterDate(org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, long options, NSDate date)Returns the range of the next weekend, via two by-reference parameters, which starts strictly after the given date.longordinalityOfUnitInUnitForDate(long smaller, long larger, NSDate date)java.lang.StringPMSymbol()NSArray<java.lang.String>quarterSymbols()NSRangerangeOfUnitInUnitForDate(long smaller, long larger, NSDate date)booleanrangeOfUnitStartDateIntervalForDate(long unit, org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, NSDate date)booleanrangeOfWeekendStartDateIntervalContainingDate(org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, NSDate date)Find the range of the weekend around the given date, returned via two by-reference parameters.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetFirstWeekday(long value)voidsetLocale(NSLocale value)voidsetMinimumDaysInFirstWeek(long value)voidsetTimeZone(NSTimeZone value)static voidsetVersion_static(long aVersion)NSArray<java.lang.String>shortMonthSymbols()NSArray<java.lang.String>shortQuarterSymbols()NSArray<java.lang.String>shortStandaloneMonthSymbols()NSArray<java.lang.String>shortStandaloneQuarterSymbols()NSArray<java.lang.String>shortStandaloneWeekdaySymbols()NSArray<java.lang.String>shortWeekdaySymbols()NSArray<java.lang.String>standaloneMonthSymbols()NSArray<java.lang.String>standaloneQuarterSymbols()NSArray<java.lang.String>standaloneWeekdaySymbols()NSDatestartOfDayForDate(NSDate date)This API returns the first moment date of a given date.static org.moe.natj.objc.Classsuperclass_static()static booleansupportsSecureCoding()NSTimeZonetimeZone()static longversion_static()NSArray<java.lang.String>veryShortMonthSymbols()NSArray<java.lang.String>veryShortStandaloneMonthSymbols()NSArray<java.lang.String>veryShortStandaloneWeekdaySymbols()NSArray<java.lang.String>veryShortWeekdaySymbols()NSArray<java.lang.String>weekdaySymbols()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSCalendar alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
autoupdatingCurrentCalendar
public static NSCalendar autoupdatingCurrentCalendar()
tracks changes to user's preferred calendar identifier
-
calendarWithIdentifier
public static NSCalendar calendarWithIdentifier(java.lang.String calendarIdentifierConstant)
This method returns a new autoreleased calendar object of the given type, specified by a calendar identifier constant. The calendar defaults to having the current locale and default time zone, for those properties.
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
currentCalendar
public static NSCalendar currentCalendar()
user's preferred calendar
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
supportsSecureCoding
public static boolean supportsSecureCoding()
-
version_static
public static long version_static()
-
AMSymbol
public java.lang.String AMSymbol()
-
PMSymbol
public java.lang.String PMSymbol()
-
calendarIdentifier
public java.lang.String calendarIdentifier()
-
compareDateToDateToUnitGranularity
public long compareDateToDateToUnitGranularity(NSDate date1, NSDate date2, long unit)
This API compares the given dates down to the given unit, reporting them equal if they are the same in the given unit and all larger units, otherwise either less than or greater than.
-
componentFromDate
public long componentFromDate(long unit, NSDate date)Get just one component's value.
-
componentsFromDate
public NSDateComponents componentsFromDate(long unitFlags, NSDate date)
-
componentsFromDateToDateOptions
public NSDateComponents componentsFromDateToDateOptions(long unitFlags, NSDate startingDate, NSDate resultDate, long opts)
-
componentsFromDateComponentsToDateComponentsOptions
public NSDateComponents componentsFromDateComponentsToDateComponentsOptions(long unitFlags, NSDateComponents startingDateComp, NSDateComponents resultDateComp, long options)
This API returns the difference between two dates specified as date components. For units which are not specified in each NSDateComponents, but required to specify an absolute date, the base value of the unit is assumed. For example, for an NSDateComponents with just a Year and a Month specified, a Day of 1, and an Hour, Minute, Second, and Nanosecond of 0 are assumed. Calendrical calculations with unspecified Year or Year value prior to the start of a calendar are not advised. For each date components object, if its time zone property is set, that time zone is used for it; if the calendar property is set, that is used rather than the receiving calendar, and if both the calendar and time zone are set, the time zone property value overrides the time zone of the calendar property. No options are currently defined; pass 0.
-
componentsInTimeZoneFromDate
public NSDateComponents componentsInTimeZoneFromDate(NSTimeZone timezone, NSDate date)
This API returns all the date components of a date, as if in a given time zone (instead of the receiving calendar's time zone). The time zone overrides the time zone of the NSCalendar for the purposes of this calculation. Note: if you want "date information in a given time zone" in order to display it, you should use NSDateFormatter to format the date.
-
copyWithZone
public java.lang.Object copyWithZone(org.moe.natj.general.ptr.VoidPtr zone)
- Specified by:
copyWithZonein interfaceNSCopying
-
dateMatchesComponents
public boolean dateMatchesComponents(NSDate date, NSDateComponents components)
This API returns YES if the date has all the matched components. Otherwise, it returns NO. It is useful to test the return value of the -nextDateAfterDate:matchingUnit:value:options:, to find out if the components were obeyed or if the method had to fudge the result value due to missing time.
-
dateByAddingComponentsToDateOptions
public NSDate dateByAddingComponentsToDateOptions(NSDateComponents comps, NSDate date, long opts)
-
dateByAddingUnitValueToDateOptions
public NSDate dateByAddingUnitValueToDateOptions(long unit, long value, NSDate date, long options)
This API returns a new NSDate object representing the date calculated by adding an amount of a specific component to a given date. The NSCalendarWrapComponents option specifies if the component should be incremented and wrap around to zero/one on overflow, and should not cause higher units to be incremented.
-
dateBySettingHourMinuteSecondOfDateOptions
public NSDate dateBySettingHourMinuteSecondOfDateOptions(long h, long m, long s, NSDate date, long opts)
This API returns a new NSDate object representing the date calculated by setting hour, minute, and second to a given time. If no such time exists, the next available time is returned (which could, for example, be in a different day than the nominal target date). The intent is to return a date on the same day as the original date argument. This may result in a date which is earlier than the given date, of course.
-
dateBySettingUnitValueOfDateOptions
public NSDate dateBySettingUnitValueOfDateOptions(long unit, long v, NSDate date, long opts)
This API returns a new NSDate object representing the date calculated by setting a specific component to a given time, and trying to keep lower components the same. If the unit already has that value, this may result in a date which is the same as the given date. Changing a component's value often will require higher or coupled components to change as well. For example, setting the Weekday to Thursday usually will require the Day component to change its value, and possibly the Month and Year as well. If no such time exists, the next available time is returned (which could, for example, be in a different day, week, month, ... than the nominal target date). Setting a component to something which would be inconsistent forces other units to change; for example, setting the Weekday to Thursday probably shifts the Day and possibly Month and Year. The specific behaviors here are as yet unspecified; for example, if I change the weekday to Thursday, does that move forward to the next, backward to the previous, or to the nearest Thursday? A likely rule is that the algorithm will try to produce a result which is in the next-larger unit to the one given (there's a table of this mapping at the top of this document). So for the "set to Thursday" example, find the Thursday in the Week in which the given date resides (which could be a forwards or backwards move, and not necessarily the nearest Thursday). For forwards or backwards behavior, one can use the -nextDateAfterDate:matchingUnit:value:options: method above.
-
dateFromComponents
public NSDate dateFromComponents(NSDateComponents comps)
-
dateWithEraYearMonthDayHourMinuteSecondNanosecond
public NSDate dateWithEraYearMonthDayHourMinuteSecondNanosecond(long eraValue, long yearValue, long monthValue, long dayValue, long hourValue, long minuteValue, long secondValue, long nanosecondValue)
Create a date with given components. Current era is assumed.
-
dateWithEraYearForWeekOfYearWeekOfYearWeekdayHourMinuteSecondNanosecond
public NSDate dateWithEraYearForWeekOfYearWeekOfYearWeekdayHourMinuteSecondNanosecond(long eraValue, long yearValue, long weekValue, long weekdayValue, long hourValue, long minuteValue, long secondValue, long nanosecondValue)
Create a date with given components. Current era is assumed.
-
encodeWithCoder
public void encodeWithCoder(NSCoder coder)
- Specified by:
encodeWithCoderin interfaceNSCoding
-
enumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock
public void enumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock(NSDate start, NSDateComponents comps, long opts, NSCalendar.Block_enumerateDatesStartingAfterDateMatchingComponentsOptionsUsingBlock block)
This method computes the dates which match (or most closely match) a given set of components, and calls the block once for each of them, until the enumeration is stopped. There will be at least one intervening date which does not match all the components (or the given date itself must not match) between the given date and any result. If the NSCalendarSearchBackwards option is used, this method finds the previous match before the given date. The intent is that the same matches as for a forwards search will be found (that is, if you are enumerating forwards or backwards for each hour with minute "27", the seconds in the date you will get in forwards search would obviously be 00, and the same will be true in a backwards search in order to implement this rule. Similarly for DST backwards jumps which repeats times, you'll get the first match by default, where "first" is defined from the point of view of searching forwards. So, when searching backwards looking for a particular hour, with no minute and second specified, you don't get a minute and second of 59:59 for the matching hour (which would be the nominal first match within a given hour, given the other rules here, when searching backwards). If the NSCalendarMatchStrictly option is used, the algorithm travels as far forward or backward as necessary looking for a match, but there are ultimately implementation-defined limits in how far distant the search will go. If the NSCalendarMatchStrictly option is not specified, the algorithm searches up to the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument. If you want to find the next Feb 29 in the Gregorian calendar, for example, you have to specify the NSCalendarMatchStrictly option to guarantee finding it. If an exact match is not possible, and requested with the NSCalendarMatchStrictly option, nil is passed to the block and the enumeration ends. (Logically, since an exact match searches indefinitely into the future, if no match is found there's no point in continuing the enumeration.) If the NSCalendarMatchStrictly option is NOT used, exactly one option from the set {NSCalendarMatchPreviousTimePreservingSmallerUnits, NSCalendarMatchNextTimePreservingSmallerUnits, NSCalendarMatchNextTime} must be specified, or an illegal argument exception will be thrown. If the NSCalendarMatchPreviousTimePreservingSmallerUnits option is specified, and there is no matching time before the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument, the method will return the previous existing value of the missing unit and preserves the lower units' values (e.g., no 2:37am results in 1:37am, if that exists). If the NSCalendarMatchNextTimePreservingSmallerUnits option is specified, and there is no matching time before the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument, the method will return the next existing value of the missing unit and preserves the lower units' values (e.g., no 2:37am results in 3:37am, if that exists). If the NSCalendarMatchNextTime option is specified, and there is no matching time before the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument, the method will return the next existing time which exists (e.g., no 2:37am results in 3:00am, if that exists). If the NSCalendarMatchFirst option is specified, and there are two or more matching times (all the components are the same, including isLeapMonth) before the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument, the method will return the first occurrence. If the NSCalendarMatchLast option is specified, and there are two or more matching times (all the components are the same, including isLeapMonth) before the end of the next instance of the next higher unit to the highest specified unit in the NSDateComponents argument, the method will return the last occurrence. If neither the NSCalendarMatchFirst or NSCalendarMatchLast option is specified, the default behavior is to act as if NSCalendarMatchFirst was specified. There is no option to return middle occurrences of more than two occurrences of a matching time, if such exist. Result dates have an integer number of seconds (as if 0 was specified for the nanoseconds property of the NSDateComponents matching parameter), unless a value was set in the nanoseconds property, in which case the result date will have that number of nanoseconds (or as close as possible with floating point numbers). The enumeration is stopped by setting *stop = YES in the block and return. It is not necessary to set *stop to NO to keep the enumeration going.
-
eraSymbols
public NSArray<java.lang.String> eraSymbols()
Methods to return component name strings localized to the calendar's locale
-
firstWeekday
public long firstWeekday()
-
getEraYearMonthDayFromDate
public void getEraYearMonthDayFromDate(org.moe.natj.general.ptr.NIntPtr eraValuePointer, org.moe.natj.general.ptr.NIntPtr yearValuePointer, org.moe.natj.general.ptr.NIntPtr monthValuePointer, org.moe.natj.general.ptr.NIntPtr dayValuePointer, NSDate date)This API is a convenience for getting era, year, month, and day of a given date. Pass NULL for a NSInteger pointer parameter if you don't care about that value.
-
getEraYearForWeekOfYearWeekOfYearWeekdayFromDate
public void getEraYearForWeekOfYearWeekOfYearWeekdayFromDate(org.moe.natj.general.ptr.NIntPtr eraValuePointer, org.moe.natj.general.ptr.NIntPtr yearValuePointer, org.moe.natj.general.ptr.NIntPtr weekValuePointer, org.moe.natj.general.ptr.NIntPtr weekdayValuePointer, NSDate date)This API is a convenience for getting era, year for week-of-year calculations, week of year, and weekday of a given date. Pass NULL for a NSInteger pointer parameter if you don't care about that value.
-
getHourMinuteSecondNanosecondFromDate
public void getHourMinuteSecondNanosecondFromDate(org.moe.natj.general.ptr.NIntPtr hourValuePointer, org.moe.natj.general.ptr.NIntPtr minuteValuePointer, org.moe.natj.general.ptr.NIntPtr secondValuePointer, org.moe.natj.general.ptr.NIntPtr nanosecondValuePointer, NSDate date)This API is a convenience for getting hour, minute, second, and nanoseconds of a given date. Pass NULL for a NSInteger pointer parameter if you don't care about that value.
-
init
public NSCalendar init()
-
initWithCalendarIdentifier
public NSCalendar initWithCalendarIdentifier(java.lang.String ident)
-
initWithCoder
public NSCalendar initWithCoder(NSCoder coder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding
-
isDateEqualToDateToUnitGranularity
public boolean isDateEqualToDateToUnitGranularity(NSDate date1, NSDate date2, long unit)
This API compares the given dates down to the given unit, reporting them equal if they are the same in the given unit and all larger units.
-
isDateInSameDayAsDate
public boolean isDateInSameDayAsDate(NSDate date1, NSDate date2)
This API compares the Days of the given dates, reporting them equal if they are in the same Day.
-
isDateInToday
public boolean isDateInToday(NSDate date)
This API reports if the date is within "today".
-
isDateInTomorrow
public boolean isDateInTomorrow(NSDate date)
This API reports if the date is within "tomorrow".
-
isDateInWeekend
public boolean isDateInWeekend(NSDate date)
This API reports if the date is within a weekend period, as defined by the calendar and calendar's locale.
-
isDateInYesterday
public boolean isDateInYesterday(NSDate date)
This API reports if the date is within "yesterday".
-
locale
public NSLocale locale()
-
longEraSymbols
public NSArray<java.lang.String> longEraSymbols()
-
maximumRangeOfUnit
public NSRange maximumRangeOfUnit(long unit)
-
minimumDaysInFirstWeek
public long minimumDaysInFirstWeek()
-
minimumRangeOfUnit
public NSRange minimumRangeOfUnit(long unit)
Calendrical calculations
-
monthSymbols
public NSArray<java.lang.String> monthSymbols()
-
nextDateAfterDateMatchingComponentsOptions
public NSDate nextDateAfterDateMatchingComponentsOptions(NSDate date, NSDateComponents comps, long options)
This method computes the next date which matches (or most closely matches) a given set of components. The general semantics follow those of the -enumerateDatesStartingAfterDate:... method above. To compute a sequence of results, use the -enumerateDatesStartingAfterDate:... method above, rather than looping and calling this method with the previous loop iteration's result.
-
nextDateAfterDateMatchingHourMinuteSecondOptions
public NSDate nextDateAfterDateMatchingHourMinuteSecondOptions(NSDate date, long hourValue, long minuteValue, long secondValue, long options)
This API returns a new NSDate object representing the date found which matches the given hour, minute, and second values. The general semantics follow those of the -enumerateDatesStartingAfterDate:... method above. To compute a sequence of results, use the -enumerateDatesStartingAfterDate:... method above, rather than looping and calling this method with the previous loop iteration's result.
-
nextDateAfterDateMatchingUnitValueOptions
public NSDate nextDateAfterDateMatchingUnitValueOptions(NSDate date, long unit, long value, long options)
This API returns a new NSDate object representing the date found which matches a specific component value. The general semantics follow those of the -enumerateDatesStartingAfterDate:... method above. To compute a sequence of results, use the -enumerateDatesStartingAfterDate:... method above, rather than looping and calling this method with the previous loop iteration's result.
-
nextWeekendStartDateIntervalOptionsAfterDate
public boolean nextWeekendStartDateIntervalOptionsAfterDate(org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, long options, NSDate date)
Returns the range of the next weekend, via two by-reference parameters, which starts strictly after the given date. The NSCalendarSearchBackwards option can be used to find the previous weekend range strictly before the date. Returns NO if there are no such things as weekend in the calendar and its locale. Note that a given entire Day within a calendar is not necessarily all in a weekend or not; weekends can start in the middle of a Day in some calendars and locales.
-
ordinalityOfUnitInUnitForDate
public long ordinalityOfUnitInUnitForDate(long smaller, long larger, NSDate date)
-
quarterSymbols
public NSArray<java.lang.String> quarterSymbols()
-
rangeOfUnitInUnitForDate
public NSRange rangeOfUnitInUnitForDate(long smaller, long larger, NSDate date)
-
rangeOfUnitStartDateIntervalForDate
public boolean rangeOfUnitStartDateIntervalForDate(long unit, org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, NSDate date)
-
rangeOfWeekendStartDateIntervalContainingDate
public boolean rangeOfWeekendStartDateIntervalContainingDate(org.moe.natj.general.ptr.Ptr<NSDate> datep, org.moe.natj.general.ptr.DoublePtr tip, NSDate date)
Find the range of the weekend around the given date, returned via two by-reference parameters. Returns NO if the given date is not in a weekend. Note that a given entire Day within a calendar is not necessarily all in a weekend or not; weekends can start in the middle of a Day in some calendars and locales.
-
setFirstWeekday
public void setFirstWeekday(long value)
-
setLocale
public void setLocale(NSLocale value)
-
setMinimumDaysInFirstWeek
public void setMinimumDaysInFirstWeek(long value)
-
setTimeZone
public void setTimeZone(NSTimeZone value)
-
shortMonthSymbols
public NSArray<java.lang.String> shortMonthSymbols()
-
shortQuarterSymbols
public NSArray<java.lang.String> shortQuarterSymbols()
-
shortStandaloneMonthSymbols
public NSArray<java.lang.String> shortStandaloneMonthSymbols()
-
shortStandaloneQuarterSymbols
public NSArray<java.lang.String> shortStandaloneQuarterSymbols()
-
shortStandaloneWeekdaySymbols
public NSArray<java.lang.String> shortStandaloneWeekdaySymbols()
-
shortWeekdaySymbols
public NSArray<java.lang.String> shortWeekdaySymbols()
-
standaloneMonthSymbols
public NSArray<java.lang.String> standaloneMonthSymbols()
-
standaloneQuarterSymbols
public NSArray<java.lang.String> standaloneQuarterSymbols()
-
standaloneWeekdaySymbols
public NSArray<java.lang.String> standaloneWeekdaySymbols()
-
startOfDayForDate
public NSDate startOfDayForDate(NSDate date)
This API returns the first moment date of a given date. Pass in [NSDate date], for example, if you want the start of "today". If there were two midnights, it returns the first. If there was none, it returns the first moment that did exist.
-
_supportsSecureCoding
public boolean _supportsSecureCoding()
Description copied from interface:NSSecureCodingThis property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.- Specified by:
_supportsSecureCodingin interfaceNSSecureCoding
-
timeZone
public NSTimeZone timeZone()
-
veryShortMonthSymbols
public NSArray<java.lang.String> veryShortMonthSymbols()
-
veryShortStandaloneMonthSymbols
public NSArray<java.lang.String> veryShortStandaloneMonthSymbols()
-
veryShortStandaloneWeekdaySymbols
public NSArray<java.lang.String> veryShortStandaloneWeekdaySymbols()
-
veryShortWeekdaySymbols
public NSArray<java.lang.String> veryShortWeekdaySymbols()
-
weekdaySymbols
public NSArray<java.lang.String> weekdaySymbols()
-
-