Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert date in to UTC Format

I want to convert the local date in UTC format.(US Format)

like image 430
Sam007 Avatar asked May 05 '11 06:05

Sam007


1 Answers

-(NSString *)getUTCFormateDate:(NSDate *)localDate
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
    [dateFormatter setTimeZone:timeZone];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateString = [dateFormatter stringFromDate:localDate];
    [dateFormatter release];
    return dateString;
}
like image 50
visakh7 Avatar answered Oct 01 '22 16:10

visakh7