ios 自定义时间日期格式

来源:互联网 发布:华为手机人工智能在哪 编辑:程序博客网 时间:2024/05/17 20:13

        CFLocaleRef currentLocale=CFLocaleCopyCurrent();

        CFDateFormatterRef customDateFormatter=CFDateFormatterCreate(NULL, currentLocale,kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);

        CFStringRef customDateFormat=CFSTR("yyyy-MM-dd HH:mm:ss");

        CFDateFormatterSetFormat(customDateFormatter, customDateFormat);

        CFStringRef customFormattedDateString=CFDateFormatterCreateStringWithDate(NULL, customDateFormatter,(CFDateRef)[NSDatedate]);


ok,在 release :

        CFRelease(currentLocale);

        CFRelease(customDateFormatter);

        CFRelease(customFormattedDateString);


原创粉丝点击