我对NSString *str = [detailsdict objectForKey:@"doc_appointments_Time"];
//time format is 5:30:00 PM
NSString *dateandtime=[NSString stringWithFormat:@"%@, %@",[detailsdict objectForKey:@"doc_appointments_Date"],str];
//date format is 10/25/2016
cell.detailTextLabel.text=dateandtime;
temaplateObj.name: obj.name,
^
SyntaxError: Unexpected token .
)有一点疑问
var temaplateObj = {};
res.render('modules/users/server/templates/getdeals', {
temaplateObj.name: obj.name,
temaplateObj.from: common.tokenInfo.name,
temaplateObj.appName: 'GAIPP',
temaplateObj.company: company,
temaplateObj.logo: logo,
temaplateObj.url:url
},
答案 0 :(得分:3)
首先,您需要在使用NSDateFormatter
之后合并日期和时间字符串,以便以您希望的格式生成日期。
NSString *stringDate = [NSString stringWithFormat:@"%@ %@",[detailsdict objectForKey:@"doc_appointments_Date"], [detailsdict objectForKey:@"doc_appointments_Time"]];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm:ss a"];
NSDate *date = [formatter dateFromString:stringDate];
[formatter setDateFormat:@"EEEE d MMMM yyyy,h:mm a"];
NSString *formattedDate = [formatter stringFromDate:date];