Birthday not coming up correctly

The wrong birthday comes up when I use NSLog to write it out.

Here is the code:

[code] NSDateComponents *myBday = [[NSDateComponents alloc] init];
[myBday setYear:1980];
[myBday setMonth:2];
[myBday setDay:1];
[myBday setHour:12];

    NSCalendar *g = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    NSDate *dateofBirth = [g dateFromComponents:myBday];
    NSLog(@"My birthday is %@.", dateofBirth);[/code]

Output comes out to: [quote]My birthday is 1980-01-31 17:00:00 +0000.[/quote]

The bday is set for Feb 1, NSLog ouputs Jan 31. Something with the time zone?

Use an NSDateFormatter object to format a date.

NSString * StringFromDate (NSDate *date)
NSLog (@"My birthday is %@.", StringFromDate (dateofBirth));

// ---------------------------------------------------------------------------------------
// Courtesy of Pretty Function -
NSString *StringFromDate (NSDate *date)
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
    [dateFormatter setDateStyle:NSDateFormatterShortStyle];
    [dateFormatter setLocale:[NSLocale currentLocale]];
    return [dateFormatter stringFromDate:date];