470,849 Members | 1,144 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

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

Jul 16 '05 #1
1 2421
Marcus écrivit:
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...


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

do :
mktime(0, 0, 0, $month, $day+1, $year)
--
P'tit Marcel
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Adam Monsen | last post: by
1 post views Thread by Ernie | last post: by
10 posts views Thread by Marc Pelletier | last post: by
3 posts views Thread by chrisdevey | last post: by
3 posts views Thread by Anna | last post: by
1 post views Thread by Gil | last post: by
3 posts views Thread by Generic Usenet Account | last post: by
27 posts views Thread by RobG | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.