Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting server time...

Status
Not open for further replies.

UnclearHorizon

Programmer
Oct 23, 2001
8
US
is it possible to make a variable or sumthin equal to the time of the server that my website is on? or can i maybe do it with mySQL? --UnclearHorizon
"The line between the real world and the wired is not so clear..." -SE:Lain
UnclearHorizon@darktechgameing.com
 
Do you mean that you want to display the current time? Then it is possible to use the time and date functions.
time() will return the current timestamp of the server. Timestamps represent the number of seconds since 1 jan 1970. This can be converted to a readable time and date with strftime (for everybody who can't read timestamps ofcourse ;-)).

strftime can be influenced by setlocale(). This can set the language for date and time, so if you want the dayname to be displayed in dutch: setlocale('nl_NL'); and wednesday will be printed as woensdag.

Hope this answers your question. mcvdmvs
-- "It never hurts to help" -- Eek the Cat
 
If you simply want to write a timestamp to MySQL, use now() as a value:

UPDATE table SET time = now();

--Acoyauh
"Artificial Intelligence is no match for Natural Stupidity"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top