Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8023493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:34:44+00:00 2026-06-04T22:34:44+00:00

I have a TimeZone problem with allday events in CalCalendar: – (BOOL)setDayType:(NSString *)type forDay:(NSDate

  • 0

I have a TimeZone problem with allday events in CalCalendar:

- (BOOL)setDayType:(NSString *)type 
            forDay:(NSDate *)date;
{
    NSError *err = nil;
    CalEvent *e = [CalEvent event];
    [e setTitle:type];
    [e setIsAllDay:YES];
    [e setStartDate:date];
    [e setEndDate:[date dateByAddingTimeInterval:1]];
    [e setCalendar:[self calendar]];
    if ( ![[CalCalendarStore defaultCalendarStore] saveEvent:e span:CalSpanThisEvent error:&err] )
    {
...

Let’s say I set the date at January 2nd, 2012, with a time of 00:00:00. I am at GMT+2, so timezone +0200. My date object reports 1-1-2012, 22:00:00, at GMT, as per this NSLog output:

"Set daytype ptd on 2012-01-01 22:00:00 +0000"

and also generates the allday even on January 1st!!

How can I make sure that I set the allday event in the correct day, for all timezones? I could easily add three hours but that will not work worldwide!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:34:46+00:00Added an answer on June 4, 2026 at 10:34 pm

    As long as date is on the correct day in the current time zone, you can use it as-in.

    The “problem” that you see is caused because if you print the stored date via NSLog (or in the debugger) it will always show you GMT time because NSDate has no knowledge of which timezone that you are in.

    However, since date is a specific point in time, when you format it for the user (using a date formatter), it will show the correct date and time, no matter what the time zone is, as long as it stays consistent.

    The only situation where you will need to worry about adding/subtracting time like you mention is if you need a point in time which is the same date across multiple time zone’s.

    EDIT:
    So it looks like iCal uses GMT time to store everything, so you need to create your date in the GMT timezone. If you need help with this, post your code where you create your NSDate and I’ll be happy to point you in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with the Ext Date class seemingly returning the wrong timezone
I have the following date string: 2011-09-06T22:02:57-04:00 . The problem is the timezone, -04:00
I have a problem.. I am working on timezone on PHP but In case
I have a ISO 8601 date, lets say: 2012-01-19T19:00-05:00 My machine timezone is GMT+1
I have a problem related to timezone behaviour of a Rails 3.1.1 application. Here
i have a problem with php.ini file. i need to change current date and
my problem is with RegularTimePeriod... i have the date in the datebase saved as
i have written a code which converts date and time into timezone , now
I have a weird problem concerning mysql timezone. In my website config file i
I have a strange problem when parsing a ISO8601 date and time with SimpleDateFormat.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.