objective c - Get 12 noon timestamp of current date in iOS? -


i want timestamp of current date reference 12 noon. can current timestamp

[[nsdate date] timeintervalsince1970]; 

but want timestamp 12 noon today.thanks in advance

i used . give 12 noon timestamp. because it's calculated per [nsdate date] , give on base of device's timezone.

nscalendar *calendar = [[nscalendar alloc] initwithcalendaridentifier:nscalendaridentifiergregorian]; nsdate *today12noon = [calendar datebysettinghour:12 minute:0 second:0 ofdate:[nsdate date] options:0];  double dif = [[nsdate date] timeintervalsince1970] - [today12noon timeintervalsince1970]; double timestampwithreference12noon = [[nsdate date] timeintervalsince1970] - dif ; 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -