I've written some functions to return the current time of the day, even in seconds. Seconds isn't that accurate because I'm using timevar, but it should do. The functions using timevar also means you can use this both clientside and serverside, which comes in pretty handy sometimes.
The only problem is that it is off when your servertime is off, and the timezone is also the one the server is in/the servertime is set to. You can adjust this by yourself though, shouldn't be a huge problem.
I hope you can find some use for this!
PHP Code:
//time functions
function getDayTime() {
//timevar * 5, it incs by 1 every 5 secs; - 30 secs; - 26 mins; - 4 hours
temp.fixedTimeVar = ((timevar * 5) - 30 - 60 * 26 - 60 * 60 * 4);
return fixedTimeVar # 86400;
}
public function getTimeHours() {
temp.var = int( getDayTime() / 3600 );
return (temp.var < 10 ? "0" @ temp.var : temp.var);
}
public function getTimeMinutes() {
temp.var = int( (getDayTime() # 3600) / 60 );
return (temp.var < 10 ? "0" @ temp.var : temp.var);
}
public function getTimeSeconds() {
temp.var = int( getDayTime() # 60 );
return (temp.var < 10 ? "0" @ temp.var : temp.var);
}
Note: Replace the # with %, the html code for it won't work in [php] tags.
Edit: Changed some code, less lines now, and I changed something that didn't really make sense after all, I have no idea why I divided by 10 in the first place...oh yea, and I forgot to mention, if the hours/minutes/seconds are smaller than 10 (so basically only one digit), it adds a 0 infront of it.