Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Question about Time Zone Offset mod

    Will the Time Zone Offset mod compensate for the start/stop
    times for sales? The reason for the question is that the
    server is about 8 hours different from most of our customers
    (eg GMT +8). As such, it is difficult to get the start/stop dates
    of sales to be 'synched' with our customers. It would be cool
    to have all sales start/stop relative to GMT. Thanks for the
    help !

  2. #2
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    Okay, I am responding to my own question.

    It looks like the start/stop times, as seen by the system, are
    determined by a function call; now() . I think that this is a SQL
    function, but I am not sure.

    So, the question now becomes, does the Time Zone Offset mod
    actually change the time as retrieved by the now() function call ?

    If not, the only way I can see to change the Sale Maker start/stop
    times to coincide with a different time zone would be to modify all
    the pertinent code and replace now() with dateadd("h", -8, now()).
    Really don't want to do that.

    Anybody have some suggestions or help with this ?

  3. #3
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    Actually, I would install the Time Zone Offset mod and then change
    all of the occurrences of now() with
    dateadd("h", .TIME_ZONE_OFFSET. , now() )_

    Big job! Can anybody clue me in as to whether I am on the right
    track and if MAYBE somebody has already done this.

  4. #4
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    There might be a much easier way to do all this.

    Why can't I just invoke the php command

    ini_set('date.timezone', 'Europe/London');

    in the PHP.ini file?

    Any session of my site would then appear to be in that
    time zone, would it not ?


    Appreciate responses.

  5. #5
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    Well, setting the time zone using the ini_set or through the htaccess
    file does not affect the time that is retrieved with the now()
    function! So, it looks like code modification is the only way to
    get what I want. YIKES !

  6. #6
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Question about Time Zone Offset mod

    Quote Originally Posted by JohnBoyCR View Post
    Well, setting the time zone using the ini_set or through the htaccess
    file does not affect the time that is retrieved with the now()
    function! So, it looks like code modification is the only way to
    get what I want. YIKES !
    You are missing what this mod does
    There are 2 times to keep track of

    There is the php time which you can set with a "TZ" variable as per the instructions in the mod. You can (should) set this both in the admin and catalog side of the website.

    There is the mysql time (which cannot normally be altered unless you control the server).
    The Time Zone Offset mod "adjusts" the times and dates stored in the database to be the same as the now adjusted php time.

    eg:
    My website is for Australia
    I live in Victoria GMT+10
    Daylight saving now so GMT+11
    My Server is in the US GMT-5
    I am 16 hours ahead of my servers time

    I use a tz variable to set the php time
    PHP Code:
    <?php 
    putenv 
    ('TZ=Australia/Melbourne'); 
    ?>
    My Time Zone Offset is set to 16 to adjust the dates and times recorded in the database to reflect my local timezone and not the servers.

    It is not designed to "fix" start and stop times in the website.
    I haven't looked at this but I assume that just setting the TZ variable to the zone you require should do what you want to do.

    This assumes that you want the start/stop times to apply to the one time zone only.

  7. #7
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    Update in response to gilby .

    I think I understand what the Time Zone Offset mod does.
    My concern is NOT what is stored in the database but how the
    site responds to the server time.

    I adjusted the site timezone using setenv, in the htaccess file,
    and the site now 'appears' to be in the time zone I want.
    However, that is not what I want to accomplish.

    When I set up a sale, I would like the sale end date to occur
    relative to the time zone that I have established for the site,
    say Europe/London. The problem is that the server is actually
    located +8 hours from London. So what happens is that the
    sale will end 8 hours earlier than I want.

    It appears to me that the stop time for the sale is computed
    in the php code by retrieving the current date using the now() function. If I were to change the manner in which the
    code computed the stop time, say by replacing now() with
    dateadd("h", -8, now() ), would it not continue the sale for
    8 hours past the server time for end of sale?

    In the final analysis, it probably isn't worth the effort. I just
    think it would make my life a little easier if I didn't have to be
    up all hours the night making sure that the customers aren't
    getting cheated by having a sale end sooner than advertised.

  8. #8
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    message to gilby and others :

    Update to how I perceive the problem and its resolution.

    The problem, as I see it, is that sales end relative to the
    server clock and not relative to whatever time zone I may have
    set using the TZ environment parameter.

    If I want to offset the sale end time in order to have the stop time
    coincide with the time zone I have established using TZ, can
    I not simply change the includes/functions/salemaker.php
    code to use dateadd("h", TIME_ZONE_OFFSET, now() ) instead
    of now() ? I would define TIME_ZONE_OFFSET in my
    English.php file.

    It is quite possible that my ignorance is showing here, but it
    would seem to me that this would be a possible solution to my
    specific problem.

    Thanks for the feedback.

  9. #9
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Question about Time Zone Offset mod

    Quote Originally Posted by JohnBoyCR View Post
    message to gilby and others :

    Update to how I perceive the problem and its resolution.

    The problem, as I see it, is that sales end relative to the
    server clock and not relative to whatever time zone I may have
    set using the TZ environment parameter.

    If I want to offset the sale end time in order to have the stop time
    coincide with the time zone I have established using TZ, can
    I not simply change the includes/functions/salemaker.php
    code to use dateadd("h", TIME_ZONE_OFFSET, now() ) instead
    of now() ? I would define TIME_ZONE_OFFSET in my
    English.php file.

    It is quite possible that my ignorance is showing here, but it
    would seem to me that this would be a possible solution to my
    specific problem.

    Thanks for the feedback.
    now() is a mysql function and the TZ variable does not affect this
    In the code replace both occurances of
    PHP Code:
    now() 
    with
    PHP Code:
    date_add(now(), INTERVAL '" . TIME_ZONE_OFFSET . "' HOUR
    If you are not using the Time Zone Offset mod then you can set the define in english.php as suggested.

  10. #10
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default Re: Question about Time Zone Offset mod

    Thanks to gilby for the reply.

    It looks like in includes/functions/salemaker.php code there are
    several references to now(), as related to sale_date_end. I
    would need to change all of those references as suggested. RIGHT?

    Plus, would I need to also apply those same changes in the
    product pricing code? And is that code

    includes/functions/functions_prices.php ?

    Or will just changing the salemaker.php code take care of the
    product pricing displayed with the sale value? I'm still an egg !

    Thanks for your help.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Stock by Attributes Mod with Time Zone Offset Mod
    By xman888 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 5 Aug 2007, 05:08 AM
  2. Time Zone Offset
    By harry2cool in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 26 Jul 2006, 09:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg