Hi to All,
I am in the process of developping a Logbook app using Cocoa in XCode.
The application has a button where you can enter the time of a record in GMT or Local Time.
I have the part working where I can enter the time into the database as GMT but when I click the button to convert back to local time, the record still enters the database as a GMT timestamp.
My code is:
So, where am I going wrong with this??
Pete
I am in the process of developping a Logbook app using Cocoa in XCode.
The application has a button where you can enter the time of a record in GMT or Local Time.
I have the part working where I can enter the time into the database as GMT but when I click the button to convert back to local time, the record still enters the database as a GMT timestamp.
My code is:
Code:
- (IBAction)changeTimeZine:(id)sender {
if ([buttonTimeZine state] == NSOffState)
{
[NSTimeZone setDefaultTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
[buttonTimeZine setTitle:@"UTC"];
[qsoDate setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
[qsoTime setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
[qsoDate setDateValue:[NSDate date]];
[qsoTime setDateValue:[NSDate date]];
}
else
{
[NSTimeZone setDefaultTimeZone:[NSTimeZone systemTimeZone]];
[buttonTimeZine setTitle:@"LOCAL"];
[qsoDate setTimeZone:[NSTimeZone timeZoneWithName:@"Australia/Brisbane"]];
[qsoTime setTimeZone:[NSTimeZone timeZoneWithName:@"Australia/Brisbane"]];
[qsoDate setDateValue:[NSDate date]];
[qsoTime setDateValue:[NSDate date]];
}
}
So, where am I going wrong with this??
Pete