Is there an efficient way to convert NSDate to an RFC 2822 date format string? I want to use this line to create an NSURLRequest and set the value of the If-Modified-Since header field.
try using NSDateFormatter
NSDateFormatter
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // maybe there exist a new-method now dateFormatter.dateFormat = @"EEE, dd MMM yyyy HH:mm:ss Z"; //RFC2822-Format NSString *dateString = [dateFormatter stringFromDate:myDate];
Swift 3
let rfcDateFormat = DateFormatter() rfcDateFormat.dateFormat = "EEE, dd MMM yyyy HH:mm:ss Z" let dateSTring = rfcDateFormat.string(from: Date()) //today result: Mon, 06 Feb 2017 17:21:18 +0100
Source: https://habr.com/ru/post/1388029/More articles:MouseListener and JTree - javaException when connecting to a swank server - emacsThe ListView switch does not apply if specified in a style declaration. - androidtemperamental ID3D10EffectVectorVariable - c ++Lange support for Gujrati and Hindi in android - androidHow can I get a file from FTP (using C #)? - c #Insert php false into mysql - phpBest way to save image? - c #Cursor inside SQL query - sqlBing Api returns 41 results for the simple word "Game" - searchAll Articles