Converting the calendar date to the correct date

I am working on an application that creates alerts with calendar. I can correctly set alarms on correct dates. For example, I set an alarm for 4th of May 2017 1 PM. When, I try to get the calendar event it returns me some other date in UTC. As you ca

Convert the swift date string

I have a date string in this format: 2016-06-20T13:01:46.457+02:00 and I need to change it to something like this: 20/06/2016 Previously I have always used this library -> SwiftDate to manipulate the dates, but it doesn't work now. I tried also somet

How to convert decimal time to NSDate?

I have times that are represented as doubles. For example: 8:00am is 8.00 1:30pm is 13.50 6:15pm is 18.25 11:20pm is 23.333 How can I convert the doubles into an NSDate of today? let input = 13.50 let hour = Int(input) let minute = Int((input - Doubl

Show selection to select Date in Watchkit

I am developing an application with the Watchkit Framework in which I want the user to select a date of birth and go to next screen. For that I want to use the Pickerview in my application. But Watchkit doesn't have any UI Element for Pickerview. In

Sorting custom objects in the UITableView section

I'm making an app whereas I have created a custom class which inherits from NSObject. This class contains various properties whereas one of them is a NSDate property and another one is a NSString. I would like to sort these objects in a UITableView u

Significant time change in Different time zone

I am working with two or three different time zones in my iOS app. I want to get the midnight time change notification/callback in all the respective time zones. I guess i can only use the UIApplicationSignificantTimeChangeNotification for the time c

Convert NSString to NSDAte again

i have a label which is : _labelCell.text = [2014-06-22 20:27:48 +0000]; What i want to do is to convert this string into NSDate so i can format it into something like : EEEE dd MM yyyy i try : // convert to date NSDateFormatter *dateFormat = [[NSDat

Get bad weather from NSDateFormatter

When I try to get values for date and time from text fields I got wrong value on console. Date and time are two text fields NSString *datestring = self.date.text; NSString *timestring = self.time.text; NSString *combined = [NSString stringWithFormat:

Compare 2 dates gives me 1 day less in IOS comparison

I am trying to compare 2 Dates but in i am getting 1 day less here is a snippet: NSDateComponents* dateComponents = [[NSDateComponents alloc] init]; [dateComponents setYear: 2014]; [dateComponents setMonth: 1]; [dateComponents setDay: 31]; NSCalendar

Create an array of NSDates as in Ruby

I want to create an array of NSDates starting from today to next month. This can easily be done in Ruby using Time.now..(Time.now + 30.days) How can I create an array of dates just like in Ruby in Objective C?Any ObjC solution is unfortunately going

DateFormat conversion

I have a string that is in this format: 2012-11-08T13:50:05.284-08:00 I need to convert it into this format: November 8, 2012 1:50 PM, I have identified the pattern of the date to YYYY-MM-DDThh:mm:ss.sTZD, like this: NSDateFormatter *dateFormat = [[N

Date format with NSDateFormatter

I want to format 06-06-2013 1:51 PM as Jun 06,2013. I have tried all possible different formatting styles using NSDateFormatter but failed. Any help would be appreciated.Try this First You need to convert this string back to NSDate then again convert

Invalid Date Returns from NSDateComponents

Why is this giving me the wrong date ? NSCalendar *myCalendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar]; NSDateComponents* components = [myCalendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit fromD

Convert NSString to MM-dd-yy format in NSDate

In my application I am getting an NSString with the date as 01-22-12(MM-dd-yy). Now I want to convert that string into an NSDate. I used the code below. But it is giving the date as 2012-01-04 05:00:00 +0000 NSDateFormatter *dateFormatter = [[NSDateF

NSDateFormatter Problem?

I am trying to parse an RSS feed, but the date is hard to parse. The date string is: publishedDate = "2013-01-08T20:09:02.000Z" Here is my code: NSDateFormatter *utc = [[NSDateFormatter alloc] init]; [utc setTimeZone:[NSTimeZone timeZoneWithName

how to get NSDate 2012-11-19T19: 35: 00.0000000-07: 00 format?

I have a format 2012-11-19T19:35:00.0000000-07:00 how can I acheive this from NSDate? NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyy-MM-dd'T'HH:mm:ssZ"]; NSDate *today = [NSDate date]; NSStri

Get two dates as substrings and store them in separate strings

In my app I have a string - "contest will start from dd/mm/yyyy to dd/mm/yyyy" I want both of the dates separately so I need a way to store these dates in two different strings.You can do this with a regular expression (semi-blatantly adapted fr

Simple NSDateFormatter / String Parse

2012-10-12 19:29:43 Aquivalent NSDateFormatter: [_dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; Throws an exception ... Why? Thank you! Reference: http://waracle.net/mobile/iphone-nsdateformatter-date-formatting-table/ UPDATE: The problem

Get the name of the days between two dates in ios?

How to get name of days between two dates in ios? Example: Input: Start Date: 3-11-2012 End date: 5-11-2012 Output: 3-11-2012 Wednesday 4-11-2012 Thursday 5-11-2012 Friday Thanks..try this, NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df se

NSDateFormatter moves the date 2 hours, why?

I want to convert the following NSString to a NSDate : @"2013-04-01T22:00:00Z" I am using the following code : NSString *dateString = @"2013-04-01T22:00:00Z"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormat

mktime (php) in iphone time (string)

I have in variable value from PHP function mktime(time from epoch), exacly 133123088. How I can change it for readable date in iphone? Is any function to convert this format to another like NSDate or just string ?NSDate* date = [NSDate dateWithTimeIn

date formatting from an NSString using NSDateFormatter

I have the following string representing a date & time NSString *shortDateString = @"Sat28Apr2012 15:00"; (no spaces (apart from a single space in front of the time), just as it is above) I would like to format this date using: NSDateFormatt

how to convert the value of string to date in the iphone

hi friend i want convert string value into date in my project because i am fetching xml value from web and in xml file i get weather condition and there all value i this weather condition i get current date but my forecastcondition is not come in dat

Date format problem

How to get this format of date from NSString; Wed, 22 Jun 2011 12:36:00 +0100 to Wed, 22 Jun 2011. ThanksTry this code. NSString *dateStr = @"Wed, 22 Jun 2011 12:36:00 +0100"; // Convert string to date object NSDateFormatter *dateFormat = [[NSDa

iOS: Problem with NSDate and NSDateComponent

NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease]; [components setTimeZone:[ NSTimeZone timeZoneForSecondsFromGMT:(+0*3600) ] ] ; [components setYear:2011]; [components setDay:13]; [components setMonth:5]; NSDate *date1 = [

iPhone: convert Nsstring to Nsdate on device timezone

I received date from Web service which is in GMT + 1 format (2010-02-25T20:16:50.387+05:30). I want to convert in NSdate. I have no proper idea about date formatter. Please suggest that how can i Change this nsstring value to current date format (Tim

Number of days in a given year using the iPhone SDK?

I'm trying to get the number of days in a current year. When I try the solution on Number of days in the current month using iPhone SDK?, and replace NSMonthCalendarUnit by NSYearCalendarUnit, I still get the number of days for that month. Does anyon