ObjFW
Public Member Functions | Static Public Member Functions
OFDate Class Reference

A class for storing, accessing and comparing dates. More...

#import <OFDate.h>

Inheritance diagram for OFDate:
OFObject <OFCopying> <OFComparing> <OFSerialization> <OFObject> <OFObject>

List of all members.

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.

Detailed Description

A class for storing, accessing and comparing dates.


Member Function Documentation

+ (id) date

Creates a new OFDate with the current date and time.

Returns:
A new, autoreleased OFDate with the current date and time
- (OFDate *) dateByAddingTimeInterval: (double)  seconds

Creates a new date with the specified time interval added.

Parameters:
secondsThe seconds after the date
Returns:
A new, autoreleased OFDate
- (OFString *) dateStringWithFormat: (OFConstantString*)  format

Creates a string of the date with the specified format.

See the manpage for strftime for information on the format.

Parameters:
formatThe format for the date string
Returns:
A new, autoreleased OFString
+ (id) dateWithDateString: (OFString*)  string
format: (OFString*)  format 

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.

Warning:
The format is currently limited to the following format specifiers: %d, %e, %H, %m, %M, %S, %y, %Y, %%, %n and %t.
Parameters:
stringThe string describing the date
formatThe format of the string describing the date
Returns:
A new, autoreleased OFDate with the specified date and time
+ (id) dateWithLocalDateString: (OFString*)  string
format: (OFString*)  format 

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.

Warning:
The format is currently limited to the following format specifiers: %d, %e, %H, %m, %M, %S, %y, %Y, %%, %n and %t.
Parameters:
stringThe string describing the date
formatThe format of the string describing the date
Returns:
A new, autoreleased OFDate with the specified date and time
+ (id) dateWithTimeIntervalSince1970: (double)  seconds

Creates a new OFDate with the specified date and time since 1970-01-01T00:00:00Z.

Parameters:
secondsThe seconds since 1970-01-01T00:00:00Z
Returns:
A new, autoreleased OFDate with the specified date and time
+ (id) dateWithTimeIntervalSinceNow: (double)  seconds

Creates a new OFDate with the specified date and time since now.

Parameters:
secondsThe seconds since now
Returns:
A new, autoreleased OFDate with the specified date and time
- (uint8_t) dayOfMonth

Returns the day of the month.

Returns:
The day of the month of the date
- (uint8_t) dayOfWeek

Returns the day of the week of the date.

Returns:
The day of the week of the date
- (uint16_t) dayOfYear

Returns the day of the year of the date.

Returns:
The day of the year of the date
+ (id) distantFuture

Returns a date in the distant future.

The date is system-dependant.

Returns:
A date in the distant future
+ (id) distantPast

Returns a date in the distant past.

The date is system-dependant.

Returns:
A date in the distant past
- (OFDate *) earlierDate: (OFDate*)  otherDate

Returns the earlier of the two dates.

Parameters:
dateAnother date
Returns:
The earlier date of the two dates
- (uint8_t) hour

Returns the hour of the date.

Returns:
The hour of the date
- (id) initWithDateString: (OFString*)  string
format: (OFString*)  format 

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.

Warning:
The format is currently limited to the following format specifiers: %d, %e, %H, %m, %M, %S, %y, %Y, %%, %n and %t.
Parameters:
stringThe string describing the date
formatThe format of the string describing the date
Returns:
An initialized OFDate with the specified date and time
- (id) initWithLocalDateString: (OFString*)  string
format: (OFString*)  format 

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.

Warning:
The format is currently limited to the following format specifiers: %d, %e, %H, %m, %M, %S, %y, %Y, %%, %n and %t.
Parameters:
stringThe string describing the date
formatThe format of the string describing the date
Returns:
An initialized OFDate with the specified date and time
- (id) initWithTimeIntervalSince1970: (double)  seconds

Initializes an already allocated OFDate with the specified date and time since 1970-01-01T00:00:00Z.

Parameters:
secondsThe seconds since 1970-01-01T00:00:00Z
Returns:
An initialized OFDate with the specified date and time
- (id) initWithTimeIntervalSinceNow: (double)  seconds

Initializes an already allocated OFDate with the specified date and time since now.

Parameters:
secondsThe seconds since now
Returns:
An initialized OFDate with the specified date and time
- (OFDate *) laterDate: (OFDate*)  otherDate

Returns the later of the two dates.

Parameters:
dateAnother date
Returns:
The later date of the two dates
- (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.

Parameters:
formatThe format for the date string
Returns:
A new, autoreleased OFString
- (uint8_t) localDayOfMonth

Returns the day of the month of the date in local time.

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.

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.

Returns:
The day of the year of the date in local time
- (uint8_t) localHour

Returns the hour of the date in local time.

Returns:
The hour of the date in local time
- (uint8_t) localMonthOfYear

Returns the month of the year of the date in local time.

Returns:
The month of the year of the date in local time
- (uint16_t) localYear

Returns the year of the date in local time.

Returns:
The year of the date in local time
- (uint32_t) microsecond

Returns the microsecond of the date.

Returns:
The microsecond of the date
- (uint8_t) minute

Returns the minute of the date.

Returns:
The minute of the date
- (uint8_t) monthOfYear

Returns the month of the year of the date.

Returns:
The month of the year of the date
- (uint8_t) second

Returns the second of the date.

Returns:
The second of the date
- (double) timeIntervalSince1970

Returns the seconds since 1970-01-01T00:00:00Z.

Returns:
The seconds since 1970-01-01T00:00:00Z
- (double) timeIntervalSinceDate: (OFDate*)  otherDate

Returns the seconds the receiver is after the date.

Parameters:
dateDate date to generate the difference with receiver
Returns:
The seconds the receiver is after the date.
- (double) timeIntervalSinceNow

Returns the seconds the receiver is in the future.

Returns:
The seconds the receiver is in the future
- (uint16_t) year

Returns the year of the date.

Returns:
The year of the date

The documentation for this class was generated from the following files:
 All Classes Functions Variables Properties