ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Calendar off by a full day

November 30, 2010 1:50am

Subscribe [8]
  • #1 / Nov 30, 2010 1:50am

    Cheif

    626 posts

    Using just the basic commands for the calendar, I’m getting a significant glitch, the event it’s displaying is off by a whole day.
    I dare not go near timezones etc but as you’ll see in the image the actual entry it represents displays correctly… whats up wit dat ?

    Before one asks, EEE 2.1 Build:  20100810, heaps of modules but none dealing with dates

  • #2 / Nov 30, 2010 8:28am

    Sue Crocker

    26054 posts

    Hi, Cheif. Have you considered upgrading to EE2.1.1? There were some fixes involving time, but do you still have DST turned on? Was it turned on when the entry was made?

  • #3 / Dec 01, 2010 10:58pm

    Cheif

    626 posts

    OK, So i have upgraded the system to 2.1.1 and the dates are still off.

    I’ve placed the article entry date in the calendar to ensure it’s reading correctly.

    {exp:channel:calendar switch="calendarToday|calendarCell" channel="events" show_future_entries="yes" show_expired="yes"}
    
    <table class="calendarBG" border="0" cellpadding="0" cellspacing="0" summary="My Calendar" width="100%">
        <tr class="calendarHeader">
            <th><div class="calendarMonthLinks"><a href="http://{previous_path=events}"><<</a></div></th>
            <th colspan="5">{date format="%F %Y"}</th>
            <th><div class="calendarMonthLinks"><a href="http://{next_path=events}class=calendarMonthLinks">>></a></div></th>
        </tr>
        <tr>
        {calendar_heading}
            <td class="calendarDayHeading">{lang:weekday_abrev}</td>
        {/calendar_heading}
        </tr>
        
        {calendar_rows }
        {row_start}<tr>{/row_start}
        
        {if entries}
            <td class='{switch}' align='center'>
            {entries}
            <div><a href="http://{title_permalink=events/item}">{title}{entry_date format="%d %F %Y %g:%i"}</a></div>
            {/entries}
            </td>
        {/if}
        
        {if not_entries}
            <td class='{switch}' align='center'>{day_number}</td>
        {/if}
        
        {if blank}
            <td class='calendarBlank'>{day_number}</td>
        {/if}
        
        {row_end}</tr>{/row_end}
        {/calendar_rows}
    </table>
    {/exp:channel:calendar}

    This is pretty much verbatim of the example code, site launch is imminent but this one will hold it back. Logins handed out where required.

  • #4 / Dec 02, 2010 4:18pm

    Ingmar

    29245 posts

    Does this only affect the calendar, i.e. is it working on the rest of the site? When you change the entry time to, say, noon, does that change anything?

  • #5 / Dec 02, 2010 6:02pm

    Cheif

    626 posts

    If I use time: 25th Dec. 12.00 it shows fine in the calendar (ie on the 25th) but as soon as I use 25th Dec. 13.00 it jumps to the next day (26 Dec.)... does this mean my server offset time should be 12 hours ?

    Server time has been checked via info, time zone is correct, time is correct… NFI now !

  • #6 / Dec 03, 2010 11:40am

    Ingmar

    29245 posts

    What timezone are you in? Do the entries as such have the correct time format, i.e. when displayed via a template instead of the calendar?

  • #7 / Dec 03, 2010 5:43pm

    Cheif

    626 posts

    Server is in AUS showing AEST, profile is set to AEST… the date “displays” correctly everywhere (see previous screen grabs) when using {entry_date} even in the calendar.
    The calendar itself displays the contents exactly as recorded; just places it in the future for any entry that has an {entry_date} between 13.00 - 23.59 using any other time 0.00 - 12.59 works as expected and displayed on the correct calendar day.

  • #8 / Dec 04, 2010 5:56pm

    Greg Salt

    3988 posts

    Hi Cheif,

    What do you have set for the server default timezone at Admin > Localization settings? Is that what you meant by “Server is in AUS showing AEST”?

    Cheers

    Greg

  • #9 / Dec 04, 2010 11:18pm

    Cheif

    626 posts

    Sorry UTC+10 (Aust. Eastern Standard Time) is the default time zone (in CP) and the same time zone as the hosting server. This one has me miffed.

  • #10 / Dec 06, 2010 3:57am

    John Henry Donovan

    12339 posts

    Cheif,

    Under your account what do you have set for your own Localization settings.

    try this inside a template to return some useful troubleshooting information

    <h1>Test of various time/date functions:</h1> 
    
    <h2>Server</h2><p> <br />
    PHP date: <?php echo date('dMy h:i');?><br />
     <br />
    PHP gmdate: <?php echo gmdate('dMy h:i');?><br />
     </p>
    
    <h2>Database dates(GMT/UTC)</h2><p> <br />
    LOC now: <?php  echo 'held in db as '.$this->EE->localize->set_localized_time(); echo ' which is '.date('d My h:i',$this->EE->localize->set_localized_time()); ?> <br />
     </p>
    
    <h2>User</h2><p> <br />
    Users timezone: <?php echo $this->EE->session->userdata['timezone'] ; ?><br />
     <br />
    Users Time:<?php echo $this->EE->localize->set_human_time(); ?>

  • #11 / Dec 06, 2010 6:33am

    Cheif

    626 posts

    I can see the database time is out but NFI what I’m really looking @.

    http://dea.beanstalkcreative.com.au/test

  • #12 / Dec 06, 2010 5:06pm

    Brandon Jones

    5500 posts

    Hi Cheif,

    As John Henry suggested double-check your own user localization settings by clicking Control Panel in the sidebar and then clicking Localization Settings on the left. Do the times change if you view the template when logged out?

  • #13 / Dec 07, 2010 5:59am

    Cheif

    626 posts

    NO, both times remain constant. Can you explain what the times I’m seeing are ?
    I can see one of the dates is is calendar day ahead but NFI what it’s referring too ?

  • #14 / Dec 07, 2010 4:00pm

    Ingmar

    29245 posts

    Have you run the code John Henry provided? Could you please paste the result here?

  • #15 / Dec 07, 2010 5:30pm

    Cheif

    626 posts

    Test of various time/date functions:
    Server
    PHP date: 08Dec10 08:28
    PHP gmdate: 07Dec10 09:28
    Database dates(GMT/UTC)
    LOC now: held in db as 1291791535 which is 08 Dec10 05:58
    User
    Users timezone: UP95
    Users Time:2010-12-08 06:58

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases