-(NSString *)setDateInFormat:(NSString *)strTxt
{
NSArray *arr = [strTxt componentsSeparatedByString:@”:”];
NSString *str = [arr objectAtIndex:0];
if ([str length] < 2)
{
if (![str hasPrefix:@”0″])
{
str = [@”0″ stringByAppendingString:str];
strTxt = str;
return [strTxt stringByAppendingString:[NSString stringWithFormat:@”:%@”,[arr objectAtIndex:1]]];
}
}
return strTxt;
}
Don’t worry if date/string has 10:00 format, it will leave as it is because it is already in correct format.