PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to make a script that can produce a CSS class upon a certain time of the day. I found the script below and gave it a shot hoping that I could save some time, but what I found is that this script is very inaccurate as it is outputting "midnight" while it is in fact around 4PM.
I can do the leg work, but I'm not sure where to start exactly as I've never messed around with the PHP time functions, etc. Where would I start? Would it be with making a Unix time stamp or something or should I try to do something else to make it more accurate?
Not sure why it's adding an hour onto the offset. The above works fine for me, but you should be returning the value, not echoing it (if you want to be picky).
Not sure why it's adding an hour onto the offset. The above works fine for me, but you should be returning the value, not echoing it (if you want to be picky).
I think the reason it's echoing the value is because it's a CSS class. So in the body tag, id would be as follows:
<body id="<?php timeBG();?>">
If you know of a better way to do this, I'm all eyes / ears. This was just something I got from a quick Google and thought that I could change it to whatever I have to have.