It looks like you're using an Ad Blocker.

Please white-list or disable AboveTopSecret.com in your ad-blocking tool.

Thank you.

 

Some features of ATS will be disabled while you continue to use an ad-blocker.

 

What time is it in PHP

page: 1
0

log in

join
share:

posted on Jan, 13 2005 @ 09:46 PM
link   
Does anyone here know anything about PHP? My question is about the time functions. If you request the time in a php script, will it be the server time or the time on the client's pc?



posted on Jan, 13 2005 @ 09:50 PM
link   
Might I recommend if you want to know about that, and more php... a book called PHP in Easy Steps. It's how I learned php, first off. lol...



posted on Jan, 13 2005 @ 09:58 PM
link   
I may end up doing that. I found a good online refrence to php, but couldn't find that exact topic. My web host is in the same time zone as me, but Duh! I guess I could set my compter's time to something different and see what happens.

Not trying to be a php master. Just playing around with it a little. I now have a random avatar, thanks to a little php script I found. I was think about making it time specific. You know, show a different avatar at night than during the day. But then I started thinking about the issue of whose time are we going off when I calculate it. I'm guessing server side, but just trying to make sure. It would be cool if you could see the time on the requesting pc.

[edit on 13-1-2005 by dbates]



posted on Jan, 13 2005 @ 10:29 PM
link   
Well time() returns the number of seconds from the Unix Epoch of Jaunary 1, 1970 at 00:00. Time in PHP is calculated this way. But...its GMT, since mine is 5 hours ahead.






Calculates the date and displays it as such: January 14, 2005, 4:29 am...when its still January 13, 2005 11:30pm for me.

Just echoing time() would just show the seconds since the epoch which does no good. You have to use the date() function to format it into the way you want.

So for Night and Day...you could use something like $amorpm = date("a",$time) which would display either am or pm, then something along the lines of using if()( and ) else (. I think you might be able to figure it out.

I havent tested the above ^^^. Just the am, pm part.

Hit quote or edit to see the unaltered code...it cant be posted without screwing it up.

[edit on 13-1-2005 by dreamlandmafia]



posted on Feb, 8 2005 @ 08:16 AM
link   
I'm getting better at php. Added current weather to signature. Not that anyone cares what the weather is here. It was just something to do. I was impressed with the filetime() function which made it easy to cache the current weather conditions and only refresh them once an hour.



posted on Mar, 17 2005 @ 10:22 PM
link   
Improved my signature by switching to true type fonts. Still loving php.



posted on Mar, 19 2005 @ 12:26 PM
link   
dbates, everything in php is serverside, just for future reference.

---Pineapple



new topics

top topics



 
0

log in

join