please help with mktime/daylight savings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus

    #1

    please help with mktime/daylight savings

    Hi all, sorry to post yet another unix timestamp question, but I've been
    looking through php.net and google and can't find exactly what i need...
    plus I think my brain has shut down from too many hours of php code... :-)

    Anyways, here is my problem... I am displaying an HTML table that
    represents a person's schedule for the week... I query a database and
    take the absolute earliest starting time, absolute latest ending time,
    and display a table with all times in between (on predetermined
    intervals). For example, say my first column represents Monday... right
    now what I am doing to get Tuesday's values is multiplying my mktime(0,
    0, 0, $month, $day, $year) value for Monday by 86,400 (the number of
    seconds in a day). Everything works perfectly fine, except when I come
    across the first Sunday in April and the last Sunday in October...

    The April Sunday still works fine, but in October, it displays that
    Sunday twice. My question is how do I take into account the difference
    in hours as a result of daylight savings time? I know I can use "I" as
    the format string in date() to see if the date is during daylight
    savings or not, and I tried using this to make it work, but it doesn't
    seem to be doing what I want.

    Thanks so much in advance for any help you can provide.

    Marcus

  • P'tit Marcel

    #2
    Re: please help with mktime/daylight savings

    Marcus écrivit:
    [color=blue]
    > For example, say my first column represents Monday...
    > right now what I am doing to get Tuesday's values is multiplying my
    > mktime(0, 0, 0, $month, $day, $year) value for Monday by 86,400 (the
    > number of seconds in a day). Everything works perfectly fine, except
    > when I come across the first Sunday in April and the last Sunday in
    > October...[/color]

    don't do :
    mktime(0, 0, 0, $month, $day, $year) + 86400

    do :
    mktime(0, 0, 0, $month, $day+1, $year)


    --
    P'tit Marcel

    Comment

    Working...