nsdateformatter

    0热度

    1回答

    我的Objective-C的新手,我得到这个疯狂的问题... 用于低精度测试案例: dateString = @ “2010-05-25 11点05分21秒”,转换成功。 dateString = @“2010-03-01 15:54:36”,转换失败。 高精度测试用例: dateString = @ “2010-05-25 11:05:21.937113”,转换成功。 dateString =

    4热度

    2回答

    我试图从字符串格式化日期到另一种格式。 例如:2012-05-29 23:55:52分成29/05 *newline* 2010。 我只是不明白这背后的NSDate和NSDateFormatter的逻辑,我想.. 任何帮助将不胜感激。谢谢:)

    0热度

    1回答

    我不确定这是否是这样做的最佳方法...但是...我需要获取以下日期/时间: Midnight at the start of today Midnight at the start of the current week (Sunday) Midnight at the start of the current month Midnight at the start of the curre

    1热度

    2回答

    假设我有类似30-10-2025 12:53的东西,我如何将它转换为NSDate?我想有一些类需要加上一个格式字符串,告诉它日期看起来像一个字符串,所以它可以解析它...我看起来在哪里?

    30热度

    6回答

    我想创建一个格式,将转换显示一个NSDate对象的日期格式: NSString *dateStr = @"2010-06-21T19:00:00-05:00"; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];

    26热度

    13回答

    返回nil我有下面的代码在OS 3.x的工作 NSString *stringDate = @"2010-06-21T20:06:36+00:00"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];

    2热度

    1回答

    根据类参考,dateFromString方法返回“使用接收器的当前设置解释的字符串的日期表示形式”。使用下面的代码: NSDateFormatter * formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier

    1热度

    3回答

    我非常接近完成我的第一个iphone应用程序,它一直是一种快乐。我试图使用当前时间通过NSTimer在UILabel上显示当前时间(NSDate)来添加运行时间码。 NSDate对我来说工作正常,显示小时,分钟,秒,毫秒。但是,而不是毫秒,我需要显示每秒24帧。 问题是我需要每秒的帧数与小时,分钟和秒同步100%,所以我不能将帧添加到单独的计时器中。我尝试过,并使其工作,但帧计时器没有与日期计时器

    5热度

    2回答

    //NSString *compileDate = [NSString stringWithFormat:@"%s", __DATE__]; NSString *compileDate = [NSString stringWithUTF8String:__DATE__]; NSDateFormatter *df = [[[NSDateFormatter alloc] init] autore

    1热度

    2回答

    我有这样的日期和时间格式: 2010-05-19 07:53:30 ,并想将其更改为: Wednesday @ 7:53PM 5/19/2010 我这样做,它可以获取当前格式: NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"