Git.framework Reference Library

GITDateTime Class Reference

GITDateTime Class Reference

Declared in GITDateTime.h

Overview

Git objects specify their creation and other dates along with the associated time zone.

This class tracks these pieces of information and also aids in creation of the date time objects from the UNIX timestamp and time zone offsets used in stored git objects.

Tasks

Properties

date

Date.

@property NSDate *date
Declared In
GITDateTime.h

timeZone

Time Zone.

@property NSTimeZone *timeZone
Declared In
GITDateTime.h

Class Methods

dateTimeWithDate:

+ (GITDateTime *)dateTimeWithDate:(NSDate *)date
Parameters
date

Date object giving the date and time for the receiver

Return Value

date time object

Discussion

Creates and returns a date time object for the date in the local time zone.

See Also
Declared In
GITDateTime.h

dateTimeWithDate:timeZone:

+ (GITDateTime *)dateTimeWithDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone
Parameters
date

Date object giving the date and time for the receiver

timeZone

time zone of the date and time

Return Value

date time object

Discussion

Creates and returns a date time object for the date in the given timeZone.

See Also
Declared In
GITDateTime.h

dateTimeWithTimestamp:timeZoneOffset:

+ (GITDateTime *)dateTimeWithTimestamp:(NSTimeInterval)seconds timeZoneOffset:(NSString *)offset
Parameters
seconds

UNIX timestamp specifying the date

offset

Zone offset from Greenwich in "+/-HHMM" format

Return Value

date time object

Discussion

Creates and returns a date time object from the UNIX timestamp seconds and the string offset.

The offset is normally of the form "+0100" or "-0100", the seconds counted from the start of the UNIX Epoch which is the first of January 1970 rather than the Mac OS X Reference Date which is the first of January 2001.

See Also
Declared In
GITDateTime.h

Instance Methods

initWithDate:

- (id)initWithDate:(NSDate *)date
Parameters
date

Date object giving the date and time for the receiver

Return Value

date time object

Discussion

Creates and returns a date time object for the date in the local time zone.

See Also
Declared In
GITDateTime.h

initWithDate:timeZone:

- (id)initWithDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone
Parameters
date

Date object giving the date and time for the receiver

timeZone

time zone of the date and time

Return Value

date time object

Discussion

Creates and returns a date time object for the date in the given timeZone.

Declared In
GITDateTime.h

initWithTimestamp:timeZoneOffset:

- (id)initWithTimestamp:(NSTimeInterval)seconds timeZoneOffset:(NSString *)offset
Parameters
seconds

UNIX timestamp specifying the date

offset

Zone offset from Greenwich in "+/-HHMM" format

Return Value

date time object

Discussion

Creates and returns a date time object from the UNIX timestamp seconds and the string offset.

The offset is normally of the form "+0100" or "-0100", the seconds counted from the start of the UNIX Epoch which is the first of January 1970 rather than the Mac OS X Reference Date which is the first of January 2001.

See Also
Declared In
GITDateTime.h

stringWithFormat:

- (NSString *)stringWithFormat:(NSString *)format
Parameters
format

The date format for the receiver. See Data Formatting Programming Guide for Cocoa for a list of the conversion specifiers permitted in date format strings.

Return Value

string representation of the receiver

Discussion

Returns a string representation of the receiver with the given format.

See Also
Declared In
GITDateTime.h

Last updated: 2011-2-20