How to format the date to IST?

前端 未结 3 759
天命终不由人
天命终不由人 2021-01-21 04:00

I have to format the date as below:

19-JUL-2014 10:27:16 IST

How can I do that? Should I send \"IST\" as string object?

I tried -

N         


        
3条回答
  •  北海茫月
    2021-01-21 04:31

    Please try this,

    NSDate *date= [NSDate date];
    NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
    [dateFormatter1 setDateFormat:@"dd-MMM-yyyy HH:mm:ss z"];
    NSLog(@"%@",[dateFormatter1 stringFromDate:date]);
    

提交回复
热议问题