MFDateFormatter Class Reference

Inherits from NSObject
Declared in MFDateFormatter.h
MFDateFormatter.m

Overview

The MFDateFormatter is singleton class that contains functions to formatting NSDate into NSString or parsing NSString into NSDate for the Mesosfer framework.

+ sharedFormatter

Gets MFDateFormatter shared instance.

+ (nonnull instancetype)sharedFormatter

Return Value

Shared instance of MFDateFormatter.

Declared In

MFDateFormatter.h

– stringFromDate:

Converts NSDate into NSString representation using the following format: yyyy-MM-dd’T'HH:mm:ss.SSS'Z'

- (nonnull NSString *)stringFromDate:(nonnull NSDate *)date

Parameters

date

NSDate to convert.

Return Value

Formatted NSString representation.

See Also

Declared In

MFDateFormatter.h

– stringFromDate:isTimestamp:

Converts NSDate into NSString representation using the following format: yyyy-MM-dd or yyyy-MM-dd’T'HH:mm:ss.SSS'Z'

- (nonnull NSString *)stringFromDate:(nonnull NSDate *)date isTimestamp:(BOOL)flag

Parameters

date

NSDate to convert.

flag

The flag to convert NSDate to timestamp

Return Value

Formatted NSString representation.

See Also

Declared In

MFDateFormatter.h

– dateFromString:

Converts NSString representation of a date into NSDate object.

- (nullable NSDate *)dateFromString:(nonnull NSString *)string

Parameters

string

NSString representation to convert.

Return Value

NSDate incapsulating the date.

Discussion

Following date formats are supported: yyyy-MM-dd yyyy-MM-dd HH:mm'Z' yyyy-MM-dd HH:mm:ss'Z' yyyy-MM-dd HH:mm:ss.SSS'Z' yyyy-MM-dd’T'HH:mm'Z' yyyy-MM-dd’T'HH:mm:ss'Z' yyyy-MM-dd’T'HH:mm:ss.SSS'Z'

Declared In

MFDateFormatter.h