-1

In my project , we have a requirement to convert the server sent time (EDT) to local time and display on UI . I have written the below code which seems to be working perfectly fine in simulator but ,it displays as blank on device .

Due to the security constraints , in my company USBV access is disabled ,so i cant debug this on device directly .PFB the code im using ..

NSDateFormatter *formatSelectedTime = [[NSDateFormatter alloc] init];

[formatSelectedTime  setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"];

    NSTimeZone *sourceTimezone =[NSTimeZone timeZoneWithAbbreviation:@"EDT"];
    NSTimeZone *destinationTimeZone = [NSTimeZone localTimeZone];
    formatSelectedTime.timeZone = sourceTimezone;
    NSDate *filledDateInEDT = [formatSelectedTime dateFromString:fillsDetails.tradeDetails.filledTimeStr];


    formatSelectedTime.timeZone = destinationTimeZone;
    NSString *filledTimeInLocalString  = [formatSelectedTime stringFromDate:filledDateInEDT];
Hot Licks
  • 47,103
  • 17
  • 93
  • 151
Rango
  • 71
  • 8
  • Have you figured out which step causes the "blank" result?? – Hot Licks Nov 20 '14 at 13:12
  • (Odds are that the input date does not match your date format. Or there's an odd chance that you're getting bit by the "NSDateFormater locale feature".) – Hot Licks Nov 20 '14 at 13:17
  • Give an example of the string you are trying to parse. Also, what is "USBV"? – Tom Harrington Nov 25 '14 at 17:28
  • Im sorry , im talking about USB port , i work for a bank and everything is restricted here ..most of the times i will be working only on simulator , very rarely i get a chance to debug directly on device.. – Rango Nov 29 '14 at 07:48

1 Answers1

0

Not sure why my post is downvoted , but i figured out the problem . i was using a custom font for the label i have used to display the converted time and for some reason it showed properly on simulator but not on device.. i have re-added the font and everything worked fine..

Rango
  • 71
  • 8