How to get the day name in ios - ios7.1

I want to get the name of the day. As an example
If I have a day like 01/08/2014 I want to find 1st is which day Monday,tuesday.....or saturday likewise. How can I do it in iOS. Please help me

Have a look at the NSDateFormatter:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:#"EEEE"];
NSString *dayName = [dateFormatter stringFromDate:yourDate];
More info within apples date formatting guide

Related

Tanzania first day of the week

To correctly setup the calendar on my project, I need to know which day is the first of the week in Tanzania.
Seems like Google doesn't know, do you?
I am referring to the main source of internationalization data in IT-world (used for Java, C# etc.):
There is no explicit entry for TZ (= ISO-3166-2 code of Tanzania) in the weekData-section of CLDR-data. In such a case CLDR-data of unicode corporation says that the code "001" should be selected. And the data for "001" are:
Monday as first day of week and 1 as minimal count of first week in year.

QML Calendar: change first day of week

Is there any way to change the first day of the week on QML Calendar?
Not only Monday/Sunday, but also for any day of the week.
I found a workaround for Monday/Sunday; force Qt.locale() for a country which has Monday or Sunday specified as first day of the week, but it is not extended to the rest of the days. Thanks in advance!

Does iOS 6 support the timezone PHT when trying to use NSDateFormat?

I am having problems with my code and not sure what is wrong with it.
NSString* dateFormat1 = #"EEE MMM dd HH:mm:ss V yyyy";
NSString* dateString1 = #"Fri Jul 26 00:00:00 PHT 2013";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:dateFormat1];
My result for iOS5.1:
2013-08-02 11:59:08.459 MySandbox[41502:c07] 2013-07-25 16:00:00 +0000
For iOS 6.0
2013-08-02 12:02:37.454 MySandbox[41581:c07] (null)
*Note, I used V, instead of zzz or Z because it still is null.
*Note 2, I tried to change PHT to PST and it worked. Changed it to JST, it didn't work.
I am guessing that I am not using the correct format. Not really sure which I should use.
*Note 3, as per this question, there really was a change in iOS5 and iOS6 so I guess that is the reason why iOS5 worked.
According to these docs from Apple, NSDateFormatter uses the Unicode date format patterns, which are part of "Unicode Technical Standard #35". This standard is evolving, and iOS 5 uses version 19 while iOS 6 uses version 25.
You can read about the supported values for the time zone in "Appendix J: Time Zone Display Names" (version 19 or version 25).
I am not exactly sure why PHT was supported before and not it isn't. But in general, the best advice I can give is to avoid using time zone abbreviations. While PHT is unique, there are many other abbreviations that are ambiguous. See the list here.
Instead, you should uses the IANA time zone name whenever possible. (The tr-35 standard calls this the "Golden Zone"). In your case, it would be Asia/Manila. You can find a full list here. I am not an Objective C developer, so I'm not sure exactly how you would use this in your input string. You can try the VVVV format specifier, but I'm not sure if it directly accepts the IANA name or not.
You might want to check the results from [NSTimeZone abbreviationDictionary] as shown in this answer. In that post, it does show PHT = "Asia/Manila", but I assume by the date that it was posted that these were generated from iOS 5.

How to get first day of week in c

I am coding little calendar program in c.
I have issue to get first day of week in current locale, i need it to format calendar. For example Sunday - is first day of week in US, but in Europe first day of week is Monday. How can i get this information for current locale? Thank you.
You can create a config file containing a map of locale and first day of the week. Read this config file and create a look up table at the beginning of the program. Refer to this table everytime you are trying to get the first day of the week for a particular locale.

how do we get the first and last day of the current month

How do we get the first day of the month and last day of the month. i am using it on a apex class.
i can get the todays date by using
date.today()
but how would i get the first and last day of the month.
Thanks
You should get familiar with the Apex Code Developers Guide as it has very good documentation for questions like this. Here's the Date methods page that you would find helpful.
With respect to your specific question, you get the first date of the month (I'll use today's month in my example) using the following
Date firstDayOfMonth = System.today().toStartOfMonth();
To get the last day of the month, use the following:
Date lastDayOfMonth = firstDayOfMonth.addDays(Date.daysInMonth(firstDayOfMonth.year(), firstDayOfMonth.month()) - 1);
I think there is a better way to solve the second problem, that is, accept the last day of the month.
firstDayOfMonth.addMonths(1).addDays(-1);

Resources