By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,824 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

please help with mktime/daylight savings

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.