Package apple.foundation
Class NSDateComponentsFormatter
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.foundation.NSFormatter
-
- apple.foundation.NSDateComponentsFormatter
-
public class NSDateComponentsFormatter extends NSFormatter
API-Since: 8.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Block_accessibilityActivateBlock_ret, NSObject.Block_accessibilityActivationPointBlock_ret, NSObject.Block_accessibilityAttributedHintBlock_ret, NSObject.Block_accessibilityAttributedLabelBlock_ret, NSObject.Block_accessibilityAttributedUserInputLabelsBlock_ret, NSObject.Block_accessibilityAttributedValueBlock_ret, NSObject.Block_accessibilityContainerTypeBlock_ret, NSObject.Block_accessibilityCustomActionsBlock_ret, NSObject.Block_accessibilityCustomRotorsBlock_ret, NSObject.Block_accessibilityDecrementBlock_ret, NSObject.Block_accessibilityElementsBlock_ret, NSObject.Block_accessibilityElementsHiddenBlock_ret, NSObject.Block_accessibilityFrameBlock_ret, NSObject.Block_accessibilityHeaderElementsBlock_ret, NSObject.Block_accessibilityHintBlock_ret, NSObject.Block_accessibilityIdentifierBlock_ret, NSObject.Block_accessibilityIncrementBlock_ret, NSObject.Block_accessibilityLabelBlock_ret, NSObject.Block_accessibilityLanguageBlock_ret, NSObject.Block_accessibilityMagicTapBlock_ret, NSObject.Block_accessibilityNavigationStyleBlock_ret, NSObject.Block_accessibilityPathBlock_ret, NSObject.Block_accessibilityPerformEscapeBlock_ret, NSObject.Block_accessibilityRespondsToUserInteractionBlock_ret, NSObject.Block_accessibilityShouldGroupAccessibilityChildrenBlock_ret, NSObject.Block_accessibilityTextualContextBlock_ret, NSObject.Block_accessibilityTraitsBlock_ret, NSObject.Block_accessibilityUserInputLabelsBlock_ret, NSObject.Block_accessibilityValueBlock_ret, NSObject.Block_accessibilityViewIsModalBlock_ret, NSObject.Block_automationElementsBlock_ret, NSObject.Block_isAccessibilityElementBlock_ret, NSObject.Block_setAccessibilityActivateBlock, NSObject.Block_setAccessibilityActivationPointBlock, NSObject.Block_setAccessibilityAttributedHintBlock, NSObject.Block_setAccessibilityAttributedLabelBlock, NSObject.Block_setAccessibilityAttributedUserInputLabelsBlock, NSObject.Block_setAccessibilityAttributedValueBlock, NSObject.Block_setAccessibilityContainerTypeBlock, NSObject.Block_setAccessibilityCustomActionsBlock, NSObject.Block_setAccessibilityCustomRotorsBlock, NSObject.Block_setAccessibilityDecrementBlock, NSObject.Block_setAccessibilityElementsBlock, NSObject.Block_setAccessibilityElementsHiddenBlock, NSObject.Block_setAccessibilityFrameBlock, NSObject.Block_setAccessibilityHeaderElementsBlock, NSObject.Block_setAccessibilityHintBlock, NSObject.Block_setAccessibilityIdentifierBlock, NSObject.Block_setAccessibilityIncrementBlock, NSObject.Block_setAccessibilityLabelBlock, NSObject.Block_setAccessibilityLanguageBlock, NSObject.Block_setAccessibilityMagicTapBlock, NSObject.Block_setAccessibilityNavigationStyleBlock, NSObject.Block_setAccessibilityPathBlock, NSObject.Block_setAccessibilityPerformEscapeBlock, NSObject.Block_setAccessibilityRespondsToUserInteractionBlock, NSObject.Block_setAccessibilityShouldGroupAccessibilityChildrenBlock, NSObject.Block_setAccessibilityTextualContextBlock, NSObject.Block_setAccessibilityTraitsBlock, NSObject.Block_setAccessibilityUserInputLabelsBlock, NSObject.Block_setAccessibilityValueBlock, NSObject.Block_setAccessibilityViewIsModalBlock, NSObject.Block_setAutomationElementsBlock, NSObject.Block_setIsAccessibilityElementBlock, NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNSDateComponentsFormatter(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NSDateComponentsFormatteralloc()static NSDateComponentsFormatterallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)longallowedUnits()Bitmask of units to include.booleanallowsFractionalUnits()Choose whether non-integer units should be used to handle display of values that can't be exactly represented with the allowed units.static booleanautomaticallyNotifiesObserversForKey(@NotNull java.lang.String key)@Nullable NSCalendarcalendar()Specifies the locale and calendar to use for formatting date components that do not themselves have calendars.static voidcancelPreviousPerformRequestsWithTarget(@NotNull java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull java.lang.Object aTarget, @NotNull org.moe.natj.objc.SEL aSelector, @Nullable java.lang.Object anArgument)static @NotNull NSArray<java.lang.String>classFallbacksForKeyedArchiver()static @NotNull org.moe.natj.objc.ClassclassForKeyedUnarchiver()booleancollapsesLargestUnit()Choose whether to express largest units just above the threshold for the next lowest unit as a larger quantity of the lower unit.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()longformattingContext()Not yet supported.booleangetObjectValueForStringErrorDescription(@Nullable org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> obj, @NotNull java.lang.String string, @Nullable org.moe.natj.general.ptr.Ptr<NSString> error)NSDateComponentsFormatter currently only implements formatting, not parsing.static longhash_static()booleanincludesApproximationPhrase()Choose whether to indicate that the allowed units/insignificant units choices lead to inexact results.booleanincludesTimeRemainingPhrase()Choose whether to produce strings like "35 minutes remaining".NSDateComponentsFormatterinit()NSDateComponentsFormatterinitWithCoder(@NotNull 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)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static @NotNull NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(@NotNull java.lang.String key)static @Nullable java.lang.StringlocalizedStringFromDateComponentsUnitsStyle(@NotNull NSDateComponents components, long unitsStyle)longmaximumUnitCount()Choose whether or not, and at which point, to round small units in large values to zero.static NSDateComponentsFormatternew_objc()@Nullable NSDatereferenceDate()Where units have variable length (number of days in a month, number of hours in a day, etc...), NSDateComponentsFormatter will calculate as though counting from the date specified by the referenceDate in the appropriate calendar.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetAllowedUnits(long value)Bitmask of units to include.voidsetAllowsFractionalUnits(boolean value)Choose whether non-integer units should be used to handle display of values that can't be exactly represented with the allowed units.voidsetCalendar(@Nullable NSCalendar value)Specifies the locale and calendar to use for formatting date components that do not themselves have calendars.voidsetCollapsesLargestUnit(boolean value)Choose whether to express largest units just above the threshold for the next lowest unit as a larger quantity of the lower unit.voidsetFormattingContext(long value)Not yet supported.voidsetIncludesApproximationPhrase(boolean value)Choose whether to indicate that the allowed units/insignificant units choices lead to inexact results.voidsetIncludesTimeRemainingPhrase(boolean value)Choose whether to produce strings like "35 minutes remaining".voidsetMaximumUnitCount(long value)Choose whether or not, and at which point, to round small units in large values to zero.voidsetReferenceDate(@Nullable NSDate value)Where units have variable length (number of days in a month, number of hours in a day, etc...), NSDateComponentsFormatter will calculate as though counting from the date specified by the referenceDate in the appropriate calendar.voidsetUnitsStyle(long value)Choose how to indicate units.static voidsetVersion_static(long aVersion)voidsetZeroFormattingBehavior(long value)Bitmask specifying how to handle zeros in units.@Nullable java.lang.StringstringForObjectValue(@Nullable java.lang.Object obj)'obj' must be an instance of NSDateComponents.@Nullable java.lang.StringstringFromDateComponents(@NotNull NSDateComponents components)Convenience method for formatting an NSDateComponents object.@Nullable java.lang.StringstringFromDateToDate(@NotNull NSDate startDate, @NotNull NSDate endDate)Normally, NSDateComponentsFormatter will calculate as though counting from referenceDate (e.g.@Nullable java.lang.StringstringFromTimeInterval(double ti)Convenience method for formatting a number of seconds.static org.moe.natj.objc.Classsuperclass_static()longunitsStyle()Choose how to indicate units.static booleanuseStoredAccessor()Deprecated.static longversion_static()longzeroFormattingBehavior()Bitmask specifying how to handle zeros in units.-
Methods inherited from class apple.foundation.NSFormatter
attributedStringForObjectValueWithDefaultAttributes, copyWithZone, editingStringForObjectValue, encodeWithCoder, isPartialStringValidNewEditingStringErrorDescription, isPartialStringValidProposedSelectedRangeOriginalStringOriginalSelectedRangeErrorDescription
-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivateBlock, accessibilityActivationPoint, accessibilityActivationPointBlock, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedHintBlock, accessibilityAttributedLabel, accessibilityAttributedLabelBlock, accessibilityAttributedUserInputLabels, accessibilityAttributedUserInputLabelsBlock, accessibilityAttributedValue, accessibilityAttributedValueBlock, accessibilityContainerType, accessibilityContainerTypeBlock, accessibilityCustomActions, accessibilityCustomActionsBlock, accessibilityCustomRotors, accessibilityCustomRotorsBlock, accessibilityDecrement, accessibilityDecrementBlock, accessibilityDirectTouchOptions, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsBlock, accessibilityElementsHidden, accessibilityElementsHiddenBlock, accessibilityFrame, accessibilityFrameBlock, accessibilityHeaderElementsBlock, accessibilityHint, accessibilityHintBlock, accessibilityIdentifierBlock, accessibilityIncrement, accessibilityIncrementBlock, accessibilityLabel, accessibilityLabelBlock, accessibilityLanguage, accessibilityLanguageBlock, accessibilityMagicTapBlock, accessibilityNavigationStyle, accessibilityNavigationStyleBlock, accessibilityPath, accessibilityPathBlock, accessibilityPerformEscape, accessibilityPerformEscapeBlock, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityRespondsToUserInteractionBlock, accessibilityScroll, accessibilityShouldGroupAccessibilityChildrenBlock, accessibilityTextualContext, accessibilityTextualContextBlock, accessibilityTraits, accessibilityTraitsBlock, accessibilityUserInputLabels, accessibilityUserInputLabelsBlock, accessibilityValue, accessibilityValueBlock, accessibilityViewIsModal, accessibilityViewIsModalBlock, accessibilityZoomInAtPoint, accessibilityZoomOutAtPoint, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, automationElements, automationElementsBlock, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hash, indexOfAccessibilityElement, isAccessibilityElement, isAccessibilityElementBlock, 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, setAccessibilityActivateBlock, setAccessibilityActivationPoint, setAccessibilityActivationPointBlock, setAccessibilityAttributedHint, setAccessibilityAttributedHintBlock, setAccessibilityAttributedLabel, setAccessibilityAttributedLabelBlock, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedUserInputLabelsBlock, setAccessibilityAttributedValue, setAccessibilityAttributedValueBlock, setAccessibilityContainerType, setAccessibilityContainerTypeBlock, setAccessibilityCustomActions, setAccessibilityCustomActionsBlock, setAccessibilityCustomRotors, setAccessibilityCustomRotorsBlock, setAccessibilityDecrementBlock, setAccessibilityDirectTouchOptions, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsBlock, setAccessibilityElementsHidden, setAccessibilityElementsHiddenBlock, setAccessibilityFrame, setAccessibilityFrameBlock, setAccessibilityHeaderElementsBlock, setAccessibilityHint, setAccessibilityHintBlock, setAccessibilityIdentifierBlock, setAccessibilityIncrementBlock, setAccessibilityLabel, setAccessibilityLabelBlock, setAccessibilityLanguage, setAccessibilityLanguageBlock, setAccessibilityMagicTapBlock, setAccessibilityNavigationStyle, setAccessibilityNavigationStyleBlock, setAccessibilityPath, setAccessibilityPathBlock, setAccessibilityPerformEscapeBlock, setAccessibilityRespondsToUserInteraction, setAccessibilityRespondsToUserInteractionBlock, setAccessibilityShouldGroupAccessibilityChildrenBlock, setAccessibilityTextualContext, setAccessibilityTextualContextBlock, setAccessibilityTraits, setAccessibilityTraitsBlock, setAccessibilityUserInputLabels, setAccessibilityUserInputLabelsBlock, setAccessibilityValue, setAccessibilityValueBlock, setAccessibilityViewIsModal, setAccessibilityViewIsModalBlock, setAutomationElements, setAutomationElementsBlock, setIsAccessibilityElement, setIsAccessibilityElementBlock, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, storedValueForKey, superclass, takeStoredValueForKey, takeValueForKey, takeValueForKeyPath, takeValuesFromDictionary, unableToSetNilForKey, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, valuesForKeys, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSDateComponentsFormatter alloc()
-
allocWithZone
public static NSDateComponentsFormatter allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(@NotNull @NotNull java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(@NotNull @NotNull java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull @NotNull java.lang.Object aTarget, @NotNull @NotNull org.moe.natj.objc.SEL aSelector, @Nullable @Nullable java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
@NotNull public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
@NotNull public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
-
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
@NotNull public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(@NotNull @NotNull java.lang.String key)
-
localizedStringFromDateComponentsUnitsStyle
@Nullable public static @Nullable java.lang.String localizedStringFromDateComponentsUnitsStyle(@NotNull @NotNull NSDateComponents components, long unitsStyle)
-
new_objc
public static NSDateComponentsFormatter 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()
-
version_static
public static long version_static()
-
allowedUnits
public long allowedUnits()
Bitmask of units to include. Set to 0 to get the default behavior. Note that, especially if the maximum number of units is low, unit collapsing is on, or zero dropping is on, not all allowed units may actually be used for a given NSDateComponents. Default value is the components of the passed-in NSDateComponents object, or years | months | weeks | days | hours | minutes | seconds if passed an NSTimeInterval or pair of NSDates. Allowed units are: NSCalendarUnitYear NSCalendarUnitMonth NSCalendarUnitWeekOfMonth (used to mean "quantity of weeks") NSCalendarUnitDay NSCalendarUnitHour NSCalendarUnitMinute NSCalendarUnitSecond Specifying any other NSCalendarUnits will result in an exception.
-
allowsFractionalUnits
public boolean allowsFractionalUnits()
Choose whether non-integer units should be used to handle display of values that can't be exactly represented with the allowed units. For example, if minutes aren't allowed, then "1h 30m" could be formatted as "1.5h". Default is NO.
-
calendar
@Nullable public @Nullable NSCalendar calendar()
Specifies the locale and calendar to use for formatting date components that do not themselves have calendars. Defaults to NSAutoupdatingCurrentCalendar. If set to nil, uses the gregorian calendar with the en_US_POSIX locale.
-
collapsesLargestUnit
public boolean collapsesLargestUnit()
Choose whether to express largest units just above the threshold for the next lowest unit as a larger quantity of the lower unit. For example: "1m 3s" vs "63s". Default is NO.
-
formattingContext
public long formattingContext()
Not yet supported.
-
getObjectValueForStringErrorDescription
public boolean getObjectValueForStringErrorDescription(@Nullable @Nullable org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> obj, @NotNull @NotNull java.lang.String string, @Nullable @Nullable org.moe.natj.general.ptr.Ptr<NSString> error)NSDateComponentsFormatter currently only implements formatting, not parsing. Until it implements parsing, this will always return NO.- Overrides:
getObjectValueForStringErrorDescriptionin classNSFormatter
-
includesApproximationPhrase
public boolean includesApproximationPhrase()
Choose whether to indicate that the allowed units/insignificant units choices lead to inexact results. In some languages, simply prepending "about " to the string will produce incorrect results; this handles those cases correctly. Default is NO.
-
includesTimeRemainingPhrase
public boolean includesTimeRemainingPhrase()
Choose whether to produce strings like "35 minutes remaining". Default is NO.
-
init
public NSDateComponentsFormatter init()
- Overrides:
initin classNSFormatter
-
initWithCoder
public NSDateComponentsFormatter initWithCoder(@NotNull @NotNull NSCoder coder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding- Overrides:
initWithCoderin classNSFormatter
-
maximumUnitCount
public long maximumUnitCount()
Choose whether or not, and at which point, to round small units in large values to zero. Examples: 1h 10m 30s, maximumUnitCount set to 0: "1h 10m 30s" 1h 10m 30s, maximumUnitCount set to 2: "1h 10m" 10m 30s, maximumUnitCount set to 0: "10m 30s" 10m 30s, maximumUnitCount set to 2: "10m 30s" Default is 0, which is interpreted as unlimited.
-
setAllowedUnits
public void setAllowedUnits(long value)
Bitmask of units to include. Set to 0 to get the default behavior. Note that, especially if the maximum number of units is low, unit collapsing is on, or zero dropping is on, not all allowed units may actually be used for a given NSDateComponents. Default value is the components of the passed-in NSDateComponents object, or years | months | weeks | days | hours | minutes | seconds if passed an NSTimeInterval or pair of NSDates. Allowed units are: NSCalendarUnitYear NSCalendarUnitMonth NSCalendarUnitWeekOfMonth (used to mean "quantity of weeks") NSCalendarUnitDay NSCalendarUnitHour NSCalendarUnitMinute NSCalendarUnitSecond Specifying any other NSCalendarUnits will result in an exception.
-
setAllowsFractionalUnits
public void setAllowsFractionalUnits(boolean value)
Choose whether non-integer units should be used to handle display of values that can't be exactly represented with the allowed units. For example, if minutes aren't allowed, then "1h 30m" could be formatted as "1.5h". Default is NO.
-
setCalendar
public void setCalendar(@Nullable @Nullable NSCalendar value)Specifies the locale and calendar to use for formatting date components that do not themselves have calendars. Defaults to NSAutoupdatingCurrentCalendar. If set to nil, uses the gregorian calendar with the en_US_POSIX locale.
-
setCollapsesLargestUnit
public void setCollapsesLargestUnit(boolean value)
Choose whether to express largest units just above the threshold for the next lowest unit as a larger quantity of the lower unit. For example: "1m 3s" vs "63s". Default is NO.
-
setFormattingContext
public void setFormattingContext(long value)
Not yet supported.
-
setIncludesApproximationPhrase
public void setIncludesApproximationPhrase(boolean value)
Choose whether to indicate that the allowed units/insignificant units choices lead to inexact results. In some languages, simply prepending "about " to the string will produce incorrect results; this handles those cases correctly. Default is NO.
-
setIncludesTimeRemainingPhrase
public void setIncludesTimeRemainingPhrase(boolean value)
Choose whether to produce strings like "35 minutes remaining". Default is NO.
-
setMaximumUnitCount
public void setMaximumUnitCount(long value)
Choose whether or not, and at which point, to round small units in large values to zero. Examples: 1h 10m 30s, maximumUnitCount set to 0: "1h 10m 30s" 1h 10m 30s, maximumUnitCount set to 2: "1h 10m" 10m 30s, maximumUnitCount set to 0: "10m 30s" 10m 30s, maximumUnitCount set to 2: "10m 30s" Default is 0, which is interpreted as unlimited.
-
setUnitsStyle
public void setUnitsStyle(long value)
Choose how to indicate units. For example, 1h 10m vs 1:10. Default is NSDateComponentsFormatterUnitsStylePositional.
-
setZeroFormattingBehavior
public void setZeroFormattingBehavior(long value)
Bitmask specifying how to handle zeros in units. This includes both padding and dropping zeros so that a consistent number digits are displayed, causing updating displays to remain more stable. Default is NSDateComponentsFormatterZeroFormattingBehaviorDefault. If the combination of zero formatting behavior and style would lead to ambiguous date formats (for example, 1:10 meaning 1 hour, 10 seconds), NSDateComponentsFormatter will throw an exception.
-
stringForObjectValue
@Nullable public @Nullable java.lang.String stringForObjectValue(@Nullable @Nullable java.lang.Object obj)'obj' must be an instance of NSDateComponents.- Overrides:
stringForObjectValuein classNSFormatter
-
stringFromDateToDate
@Nullable public @Nullable java.lang.String stringFromDateToDate(@NotNull @NotNull NSDate startDate, @NotNull @NotNull NSDate endDate)Normally, NSDateComponentsFormatter will calculate as though counting from referenceDate (e.g. in February, 1 month formatted as a number of days will be 28). -stringFromDate:toDate: calculates from the passed-in startDate instead. See 'allowedUnits' for how the default set of allowed units differs from -stringFromDateComponents:. Note that this is still formatting the quantity of time between the dates, not the pair of dates itself. For strings like "Feb 22nd - Feb 28th", use NSDateIntervalFormatter.
-
stringFromDateComponents
@Nullable public @Nullable java.lang.String stringFromDateComponents(@NotNull @NotNull NSDateComponents components)Convenience method for formatting an NSDateComponents object. This calculates the count of the unit(s) starting from referenceDate.
-
stringFromTimeInterval
@Nullable public @Nullable java.lang.String stringFromTimeInterval(double ti)
Convenience method for formatting a number of seconds. See 'allowedUnits' for how the default set of allowed units differs from -stringFromDateComponents:. This calculates the count of the unit(s) from referenceDate to the passed-in time interval.
-
unitsStyle
public long unitsStyle()
Choose how to indicate units. For example, 1h 10m vs 1:10. Default is NSDateComponentsFormatterUnitsStylePositional.
-
zeroFormattingBehavior
public long zeroFormattingBehavior()
Bitmask specifying how to handle zeros in units. This includes both padding and dropping zeros so that a consistent number digits are displayed, causing updating displays to remain more stable. Default is NSDateComponentsFormatterZeroFormattingBehaviorDefault. If the combination of zero formatting behavior and style would lead to ambiguous date formats (for example, 1:10 meaning 1 hour, 10 seconds), NSDateComponentsFormatter will throw an exception.
-
referenceDate
@Nullable public @Nullable NSDate referenceDate()
Where units have variable length (number of days in a month, number of hours in a day, etc...), NSDateComponentsFormatter will calculate as though counting from the date specified by the referenceDate in the appropriate calendar. Defaults to [NSDate dateWithTimeIntervalSinceReferenceDate:0] at the time of the -stringForObjectValue: call if not set. Set to nil to get the default behavior. API-Since: 11.0
-
setReferenceDate
public void setReferenceDate(@Nullable @Nullable NSDate value)Where units have variable length (number of days in a month, number of hours in a day, etc...), NSDateComponentsFormatter will calculate as though counting from the date specified by the referenceDate in the appropriate calendar. Defaults to [NSDate dateWithTimeIntervalSinceReferenceDate:0] at the time of the -stringForObjectValue: call if not set. Set to nil to get the default behavior. API-Since: 11.0
-
useStoredAccessor
@Deprecated public static boolean useStoredAccessor()
Deprecated.
-
-