Real server time ...

A

Anonymous

Guest
Hey all

When I use time() it returns my computer time, is here any way to get my server's time?
 
WoozyDuck said:
Hey all

When I use time() it returns my computer time, is here any way to get my server's time?
use exec() to run system command
 
Thanx for the tip
where can I find a list of exec() command parameters?
 
exec("C:\Windows\iexplore.exe") will run ie..
exec("batfile.bat") will run a batfile.bat that is placed in the same dir as a script...
exec is the same thing as a command prompt..
 
ok thanx
in that case I have to run Linux commands to get TIME from my server
as its based in Linux!

so can you give me a PHP example how can I get server time using that command?
 
WoozyDuck said:
When I use time() it returns my computer time, is here any way to get my server's time?

I'm not sure why ruturajv is telling you to use exec(). If you use the PHP function time() it will always tell you the time on the server. PHP has no way to know what the time on the client is, so it will never return the time on the client, unless, of course, the client is running on the same machine as the server. Don't use system calls as ruturajv describes unless you absolutely have to, and in this case you definitely don't have to.
 
ok thanx for tha all answer
I will give it a try
actually I am cofused but I will test it now
Thanx :)
 
swirlee said:
WoozyDuck said:
When I use time() it returns my computer time, is here any way to get my server's time?

I'm not sure why ruturajv is telling you to use exec(). If you use the PHP function time() it will always tell you the time on the server. PHP has no way to know what the time on the client is, so it will never return the time on the client, unless, of course, the client is running on the same machine as the server. Don't use system calls as ruturajv describes unless you absolutely have to, and in this case you definitely don't have to.
:) it was just an option to find time in an other way than php, yes obviously php picks up the same time :-D
 
Back
Top