Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Incorrect time

My Vanilla Installation s showing different time. where can i Set my time , i have to set Indian Standard time while the Server is at US.

Best Answers

«1

Answers

  • Options
    hgtonighthgtonight ∞ · New Moderator

    In your bootstrap.php file, find the date_default_timezone_set('UTC'); line. You can change UTC to your closest supported timezone. The list of supported timezones can be found here: http://www.php.net/manual/en/timezones.php

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    i changed

    // Make sure a default time zone is set
    date_default_timezone_set('UTC')+05.60;

    TO
    // Make sure a default time zone is set
    date_default_timezone_set('Asia/Calcutta')

    didnt work again i changed to

    // Make sure a default time zone is set
    date_default_timezone_set('UTC')+05.30;

    again there is a difference in time for 31 Minutes , what may be the error ?

  • Options
    peregrineperegrine MVP
    edited June 2014

    date_default_timezone_set('Asia/Kolkata');

    do you know your version of vanilla? if so why don't you follow the posting suggestions to include it in every one of the discussions you create?

    and depending on your php version you may need to use

    date_default_timezone_set('Asia/Kolkata');

    if the below does not work.

    date_default_timezone_set('Asia/Calcutta')

    as far as

    date_default_timezone_set('UTC')+05.30; // this is gibberish.

    @abhilashsnair
    do you know your version of vanilla? if so why don't you follow the posting suggestions to include it in every one of the discussions you create?

    http://vanillaforums.org/discussion/26710/why-adding-your-version-is-more-important-than-ever

    http://vanillaforums.org/discussion/26943/tutorial-how-to-determine-the-version-number-of-vanilla-that-you-are-using-for-your-own-forum

    I also added these I am sure they will be useful.

    http://vanillaforums.org/discussion/18015/how-to-ask-questions-on-the-internet

    when-asking-a-question

    http://vanillaforums.org/discussion/25115/how-to-how-can-a-new-user-better-help-the-community-

    and a few other helpful links:

    http://vanillaforums.org/discussion/23130/forum-post-ettikett-etiquette

    http://vanillaforums.org/discussion/17954/food-for-thought-forum-etiquette

    http://vanillaforums.org/discussion/23483/advice-for-all-those-just-starting-out-with-vanilla

    troubleshooting tips: http://vanillaforums.org/discussion/20231/how-to-become-somewhat-adept-at-modifying-vanilla-

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Vanilla Version 2.1

    both these
    date_default_timezone_set('Asia/Kolkata');
    &
    date_default_timezone_set('Asia/Calcutta')

    is not working for me

  • Options
    peregrineperegrine MVP
    edited June 2014

    @abhilashsnair said:
    Vanilla Version 2.1

    both these
    date_default_timezone_set('Asia/Kolkata');
    &
    date_default_timezone_set('Asia/Calcutta')

    is not working for me

    should I guess what not working means or do you want to explain and post example screen shots.

    is the time wrong for logged in users or non-logged in users.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    A
    Attached screenshot look at the system time and post time. I took screen immediatly after posting

  • Options
    peregrineperegrine MVP
    edited June 2014

    and what is in your hour offset in your user table for user abhilash?

    and what is in your bootstrap.php.

    is your goal to set it to the time in calcutta?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Here is by bootstrap.php

    http://pastebin.com/fkkGY38M

  • Options
    peregrineperegrine MVP
    edited June 2014

    .

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited June 2014

    .

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited June 2014

    @abhilashsnair

    you apparently say the question is answered. does that mean you solved it.

    http://vanillaforums.org/discussion/25115/how-to-how-can-a-new-user-better-help-the-community-

    http://vanillaforums.org/addon/versioncheck-plugin

    you have a bad habit of not responding to completion with almost every discussion you start

    http://vanillaforums.org/profile/discussions/15823/abhilashsnair

    not a one says thanks or that it is solved and how you solved it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    sorry for what i done before Will close all threads . but this case is not solved :)

  • Options

    try creating a testdate.php and post your results.

    <?php
    
    echo date_default_timezone_get();
    echo "<br \>";
    //ini_set('date.timezone',"Asia/Calcutta");
    $today = date("F j, Y, g:i a");   
    echo "default date: $today";
    
    echo "<br \>";
    date_default_timezone_set("Asia/Calcutta");
    echo "new timezone:" . date_default_timezone_get();
    $today = date("F j, Y, g:i a");   
    echo "<br \>";
    echo "Calcutta date: $today";
    echo "<br \>";
    date_default_timezone_set("'Asia/Kolkata'");
    $today = date("F j, Y, g:i a");    
    echo "new timezone:" . date_default_timezone_get();
    echo "<br \>";
    echo "Kolkata date: $today";
    echo "<br \>";
    system("php -v");
    ?>
    <script>
     var d = new Date()
      var hourOffset = -Math.round(d.getTimezoneOffset() / 60);
          alert(hourOffset);
    </script>
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited June 2014

    since vanilla has a bug I believe and can't store offsets in 1/2 increments.

    for any new discussions posted.

    You may need to change the structure on the user table to allow 1/2 hour increments.

    I suppose you could set it to

    HourOffset decimal(3,1) in the User table

    ALTER TABLE `GDN_User` CHANGE `HourOffset` `HourOffset` DECIMAL( 3, 1 ) NOT NULL DEFAULT '0.0'
    

    in the user table so it can store all types of timezones.


    in js/global.js

    haven't tested it, but it might work as well.
    
           var d = new Date()
           var hourOffset = -Math.round(d.getTimezoneOffset() / 60);
    
    to 
    
          var d = new Date()
           var hourOffset = -(d.getTimezoneOffset() / 60);
    

    you don't need to change bootstrap.php and probably should restore the original found here

    https://github.com/vanilla/vanilla/blob/2.1/bootstrap.php

    logged in users should now see correct time in Calcutta, with above changes to database and global.js.

    report back.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    x00x00 MVP
    edited June 2014

    I alway thought that half hour offsets are funny.

    Might as well bring back bristol time GMT-10 minutes.

    grep is your friend.

  • Options
    x00x00 MVP
    edited June 2014

    Bristol clock with two minute hands:

    image

    Calcutta actually had it own time until 1945, and Bombay/Mumbai till 1955.

    grep is your friend.

  • Options
    peregrineperegrine MVP
    edited June 2014

    if it weren't for railroads and commerce - we'd all be on non-standardized times.

    http://en.wikipedia.org/wiki/Time_zone

    but then again manana is always manana

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    copied to an Indian Server (IST) still there is a lag of 40 Minutes @peregrine

  • Options
    peregrineperegrine MVP
    edited June 2014

    and what changes did you make?

    http://vanillaforums.org/discussion/comment/209903/#Comment_209903

    what does the user table say for hour offset in the structure.

    the idea is to explain what you did step by step (don't say I did it all), if you want help no one can guess what you did!!

    do you really want help solving issue, if so, answer all questions, and state exactly what you did.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.