How to get start date of current year in iOS

Mihir Oza

I don't know how to use NSDate or NSCalendar in this condition.
Help me to solve this issue.

Britto Thomas
-(NSDate *)getFirstDateOfCurrentYear
 {
  //Get current year
  NSDate *currentYear=[[NSDate alloc]init];
  currentYear=[NSDate date];
  NSDateFormatter *formatter1 = [[NSDateFormatter alloc] init];
  [formatter1 setDateFormat:@"yyyy"];
  NSString *currentYearString = [formatter1 stringFromDate:currentYear];

  //Get first date of current year
  NSString *firstDateString=[NSString stringWithFormat:@"10 01-01-%@",currentYearString];
  NSDateFormatter *formatter2 = [[NSDateFormatter alloc] init];
  [formatter2 setDateFormat:@"hh dd-MM-yyyy"];
  NSDate *firstDate = [[NSDate alloc]init];
  firstDate = [formatter2 dateFromString:firstDateString];

  return firstDate;
 }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Get start date of current financial year

From Dev

Get the last day of the current year as date

From Dev

Getting the year of the current date

From Dev

How to parse "dd-MM" date format to get current year?"

From Dev

How to get current year with coffeescript

From Dev

How to get current system year in Prolog as a number

From Dev

How to get next month start date and end date if current month is february?

From Dev

How to get current Year Using VBA

From Dev

Get start and end date of current week in Sybase

From Dev

how to get the current year in dropdown

From Dev

how get the last week as start date and end date based on date in current week in scrapy

From Dev

How to get the ISOweek and the start and end date of each every week in the whole year using sql server

From Dev

R/ Shiny - How to get current year with Sys.Date()?

From Dev

How to get the number of hours since the start of January 1 of the current year?

From Dev

How do I get the start date and end date of the current week?

From Dev

Get start date of current financial year

From Dev

I want to get all the weeks in a year with the start and end working day date for each week in java starting at current date?

From Dev

How to get current year in android?

From Dev

How to get a specific date in the current year

From Dev

How to get the Current Year to Current date in sql server 2008

From Dev

How to get iOS date format of current date into an integer?

From Dev

How to Get Date and Year from Date in SQL

From Dev

how get the last week start date and end date based on date in current week ruby

From Dev

how to get current date from server in iOS?

From Dev

Issue while getting start and end date of current Year

From Dev

How to get current date in year type

From Dev

How To get start date and end date of a current Quarter..?

From Dev

how to get the current year and the next year in asp?

From Dev

How to get the number of months that the current year has passed(relative to the current date)?

Related Related

  1. 1

    Get start date of current financial year

  2. 2

    Get the last day of the current year as date

  3. 3

    Getting the year of the current date

  4. 4

    How to parse "dd-MM" date format to get current year?"

  5. 5

    How to get current year with coffeescript

  6. 6

    How to get current system year in Prolog as a number

  7. 7

    How to get next month start date and end date if current month is february?

  8. 8

    How to get current Year Using VBA

  9. 9

    Get start and end date of current week in Sybase

  10. 10

    how to get the current year in dropdown

  11. 11

    how get the last week as start date and end date based on date in current week in scrapy

  12. 12

    How to get the ISOweek and the start and end date of each every week in the whole year using sql server

  13. 13

    R/ Shiny - How to get current year with Sys.Date()?

  14. 14

    How to get the number of hours since the start of January 1 of the current year?

  15. 15

    How do I get the start date and end date of the current week?

  16. 16

    Get start date of current financial year

  17. 17

    I want to get all the weeks in a year with the start and end working day date for each week in java starting at current date?

  18. 18

    How to get current year in android?

  19. 19

    How to get a specific date in the current year

  20. 20

    How to get the Current Year to Current date in sql server 2008

  21. 21

    How to get iOS date format of current date into an integer?

  22. 22

    How to Get Date and Year from Date in SQL

  23. 23

    how get the last week start date and end date based on date in current week ruby

  24. 24

    how to get current date from server in iOS?

  25. 25

    Issue while getting start and end date of current Year

  26. 26

    How to get current date in year type

  27. 27

    How To get start date and end date of a current Quarter..?

  28. 28

    how to get the current year and the next year in asp?

  29. 29

    How to get the number of months that the current year has passed(relative to the current date)?

HotTag

Archive