ObjFW
|
A class for storing, accessing and comparing dates. More...
#import <OFDate.h>
Public Member Functions | |
(id) | - initWithTimeIntervalSince1970: |
Initializes an already allocated OFDate with the specified date and time since 1970-01-01T00:00:00Z. | |
(id) | - initWithTimeIntervalSinceNow: |
Initializes an already allocated OFDate with the specified date and time since now. | |
(id) | - initWithDateString:format: |
Initializes an already allocated OFDate with the specified string in the specified format. | |
(id) | - initWithLocalDateString:format: |
Initializes an already allocated OFDate with the specified string in the specified format. | |
(uint32_t) | - microsecond |
Returns the microsecond of the date. | |
(uint8_t) | - second |
Returns the second of the date. | |
(uint8_t) | - minute |
Returns the minute of the date. | |
(uint8_t) | - hour |
Returns the hour of the date. | |
(uint8_t) | - localHour |
Returns the hour of the date in local time. | |
(uint8_t) | - dayOfMonth |
Returns the day of the month. | |
(uint8_t) | - localDayOfMonth |
Returns the day of the month of the date in local time. | |
(uint8_t) | - monthOfYear |
Returns the month of the year of the date. | |
(uint8_t) | - localMonthOfYear |
Returns the month of the year of the date in local time. | |
(uint16_t) | - year |
Returns the year of the date. | |
(uint16_t) | - localYear |
Returns the year of the date in local time. | |
(uint8_t) | - dayOfWeek |
Returns the day of the week of the date. | |
(uint8_t) | - localDayOfWeek |
Returns the day of the week of the date in local time. | |
(uint16_t) | - dayOfYear |
Returns the day of the year of the date. | |
(uint16_t) | - localDayOfYear |
Returns the day of the year of the date in local time. | |
(OFString *) | - dateStringWithFormat: |
Creates a string of the date with the specified format. | |
(OFString *) | - localDateStringWithFormat: |
Creates a string of the local date with the specified format. | |
(OFDate *) | - earlierDate: |
Returns the earlier of the two dates. | |
(OFDate *) | - laterDate: |
Returns the later of the two dates. | |
(double) | - timeIntervalSince1970 |
Returns the seconds since 1970-01-01T00:00:00Z. | |
(double) | - timeIntervalSinceDate: |
Returns the seconds the receiver is after the date. | |
(double) | - timeIntervalSinceNow |
Returns the seconds the receiver is in the future. | |
(OFDate *) | - dateByAddingTimeInterval: |
Creates a new date with the specified time interval added. | |
Static Public Member Functions | |
(id) | + date |
Creates a new OFDate with the current date and time. | |
(id) | + dateWithTimeIntervalSince1970: |
Creates a new OFDate with the specified date and time since 1970-01-01T00:00:00Z. | |
(id) | + dateWithTimeIntervalSinceNow: |
Creates a new OFDate with the specified date and time since now. | |
(id) | + dateWithDateString:format: |
Creates a new OFDate with the specified string in the specified format. | |
(id) | + dateWithLocalDateString:format: |
Creates a new OFDate with the specified string in the specified format. | |
(id) | + distantFuture |
Returns a date in the distant future. | |
(id) | + distantPast |
Returns a date in the distant past. |
A class for storing, accessing and comparing dates.
+ (id) date |
- (OFDate *) dateByAddingTimeInterval: | (double) | seconds |
Creates a new date with the specified time interval added.
seconds | The seconds after the date |
- (OFString *) dateStringWithFormat: | (OFConstantString*) | format |
Creates a string of the date with the specified format.
See the manpage for strftime for information on the format.
format | The format for the date string |
Creates a new OFDate with the specified string in the specified format.
The time zone used is UTC. If a time zone is specified anyway, an OFInvalidFormatException is thrown. See +[dateWithLocalDateString:format:] if you want to specify a time zone.
See the manpage for strftime for information on the format.
string | The string describing the date |
format | The format of the string describing the date |
Creates a new OFDate with the specified string in the specified format.
If no time zone is specified, local time is assumed.
See the manpage for strftime for information on the format.
string | The string describing the date |
format | The format of the string describing the date |
+ (id) dateWithTimeIntervalSince1970: | (double) | seconds |
+ (id) dateWithTimeIntervalSinceNow: | (double) | seconds |
- (uint8_t) dayOfMonth |
Returns the day of the month.
- (uint8_t) dayOfWeek |
Returns the day of the week of the date.
- (uint16_t) dayOfYear |
Returns the day of the year of the date.
+ (id) distantFuture |
Returns a date in the distant future.
The date is system-dependant.
+ (id) distantPast |
Returns a date in the distant past.
The date is system-dependant.
Returns the earlier of the two dates.
date | Another date |
- (uint8_t) hour |
Returns the hour of the date.
Initializes an already allocated OFDate with the specified string in the specified format.
The time zone used is UTC. If a time zone is specified anyway, an OFInvalidFormatException is thrown. See -[initWithLocalDateString:format:] if you want to specify a time zone.
See the manpage for strftime for information on the format.
string | The string describing the date |
format | The format of the string describing the date |
Initializes an already allocated OFDate with the specified string in the specified format.
If no time zone is specified, local time is assumed.
See the manpage for strftime for information on the format.
string | The string describing the date |
format | The format of the string describing the date |
- (id) initWithTimeIntervalSince1970: | (double) | seconds |
- (id) initWithTimeIntervalSinceNow: | (double) | seconds |
Returns the later of the two dates.
date | Another date |
- (OFString *) localDateStringWithFormat: | (OFConstantString*) | format |
Creates a string of the local date with the specified format.
See the manpage for strftime for information on the format.
format | The format for the date string |
- (uint8_t) localDayOfMonth |
Returns the day of the month of the date in local time.
- (uint8_t) localDayOfWeek |
Returns the day of the week of the date in local time.
- (uint16_t) localDayOfYear |
Returns the day of the year of the date in local time.
- (uint8_t) localHour |
Returns the hour of the date in local time.
- (uint8_t) localMonthOfYear |
Returns the month of the year of the date in local time.
- (uint16_t) localYear |
Returns the year of the date in local time.
- (uint32_t) microsecond |
Returns the microsecond of the date.
- (uint8_t) minute |
Returns the minute of the date.
- (uint8_t) monthOfYear |
Returns the month of the year of the date.
- (uint8_t) second |
Returns the second of the date.
- (double) timeIntervalSince1970 |
Returns the seconds since 1970-01-01T00:00:00Z.
- (double) timeIntervalSinceDate: | (OFDate*) | otherDate |
Returns the seconds the receiver is after the date.
date | Date date to generate the difference with receiver |
- (double) timeIntervalSinceNow |
Returns the seconds the receiver is in the future.
- (uint16_t) year |
Returns the year of the date.