ios - Strange NSDateComponents Behavior -


i use following method weekday of date passed in:

+ (nsinteger)weekdayfromdate:(nsdate *)date {     nsdatecomponents *datecomponents = [[nscalendar currentcalendar] components:nsweekdaycalendarunit fromdate:date];     return datecomponents.weekday % 7; } 

this method returning 2 different numbers same date on different devices. instance use nsdate nsstring:

dateformatter = [nsdateformatter new]; dateformatter.dateformat = @"mm/dd/yyyy"; dateformatter.timezone = [nstimezone timezonewithname:@"america/new_york"]; nsdate *date = [dateformatter datefromstring:@"03/11/2014"]; 

for of testing devices weekday returned 2 (what should monday), on other devices running same code returned date 3 (what should tuesday: proper date). why variation occurring? there way fix issue?


Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -