How to Dispaly Or Echo the Apache Server Time?
Moderator: General Moderators
-
jagannathg
- Forum Commoner
- Posts: 34
- Joined: Wed Dec 08, 2010 1:55 am
How to Dispaly Or Echo the Apache Server Time?
Hello All,
I am finding difficulties in displaying the Apache Web Server Time on my php page.
Note: I dont want to display the Local Time of the machine but I want to display the Server Time.
Can any one help me with this.
Thanks
Jagannath
I am finding difficulties in displaying the Apache Web Server Time on my php page.
Note: I dont want to display the Local Time of the machine but I want to display the Server Time.
Can any one help me with this.
Thanks
Jagannath
-
jagannathg
- Forum Commoner
- Posts: 34
- Joined: Wed Dec 08, 2010 1:55 am
Re: How to Dispaly Or Echo the Apache Server Time?
Hello All,
I did some search and found, Timestamp of the start of the request is available in $_SERVER['REQUEST_TIME'].
Anyone who can help me with the useage of $_SERVER['REQUEST_TIME'] that would be great!!!
And I have a question, is it the right variable that will capture and show the Server Time?
Regards,
Jagannath
I did some search and found, Timestamp of the start of the request is available in $_SERVER['REQUEST_TIME'].
Anyone who can help me with the useage of $_SERVER['REQUEST_TIME'] that would be great!!!
And I have a question, is it the right variable that will capture and show the Server Time?
Regards,
Jagannath
-
jagannathg
- Forum Commoner
- Posts: 34
- Joined: Wed Dec 08, 2010 1:55 am
Re: How to Dispaly Or Echo the Apache Server Time?
Any help on this will be great!!!
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How to Dispaly Or Echo the Apache Server Time?
What's wrong with:
or similar format???
Code: Select all
echo date('h:i:s A');mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: How to Dispaly Or Echo the Apache Server Time?
php function time() will give you the same thing as $_SERVER['REQUEST_TIME']
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
jagannathg
- Forum Commoner
- Posts: 34
- Joined: Wed Dec 08, 2010 1:55 am
Re: How to Dispaly Or Echo the Apache Server Time?
Thanks Shwan I got the hang of the date and time. I did some google and got some hang of the Date and Time outputs and there format. Below is my same php code for date and time formats AND Date and Time in Unix:AbraCadaver wrote:What's wrong with:
or similar format???Code: Select all
echo date('h:i:s A');
Date and Time Format:
Code: Select all
<html>
<head>
<title>Date and Time: Unix</title>
</head>
<body>
<?php
//Formating the Date and Time
//Usage of $timestamp, time() function and strftime() function
$timestamp = time();
echo strftime("The date today is %m/%d/%y", $timestamp);
//Displaying MySQL Date Time format
echo "<hr />";
$dt = time();
$dt1 = time();
$dt2 = time();
$mysql_datetime = strftime("%Y-%m-%d %H:%M:%S", $dt);
$mysql_datetime1 = strftime("%d %B %Y", $dt1);
$mysql_datetime2 = strftime("%H:%M %p", $dt2);
echo $mysql_datetime;
echo "<br />";
echo $mysql_datetime1;
echo "<br />";
echo $mysql_datetime2;
?>
</body>
</html>
Code: Select all
<html>
<head>
<title>Date and Time: Unix</title>
</head>
<body>
<?php
echo time();
echo "<br />";
echo mktime(10, 25, 30, 4, 13, 2011);
echo "<br />";
//Usage of Check Date Function
//This will return the value as true as the Date is Valid
echo checkdate(12,31,2010) ? 'true' : 'false';
echo "<br />";
//This will return the value as false as the Date is Invalid and does not exist
echo checkdate(2,31,2010) ? 'true' : 'false';
echo "<br />";
//Usage of strtotime() function with now
$unix_timestamp = strtotime("now");
echo $unix_timestamp . "<br />";
//Usage of strtotime() function with a specific date
$unix_timestamp = strtotime("December 12, 2010");
echo $unix_timestamp . "<br />";
//Usage of strtotime() function with a future date or day
$unix_timestamp = strtotime("+1 day");
echo $unix_timestamp . "<br />";
//Usage of strtotime() function with past day
$unix_timestamp = strtotime("last Monday");
echo $unix_timestamp . "<br />";
?>
</body>
</html>
Regards,
Jagannath
-
jagannathg
- Forum Commoner
- Posts: 34
- Joined: Wed Dec 08, 2010 1:55 am
Re: How to Dispaly Or Echo the Apache Server Time?
Hello s.dot,s.dot wrote:php function time() will give you the same thing as $_SERVER['REQUEST_TIME']
Is there any major difference between time() function and using Global Variable $_SERVER['REQUEST_TIME']
do let me know if they are any differences and that could make some impact on the code!!!
Thanks for your reply!!!
Regards,
Jagannath
Re: How to Dispaly Or Echo the Apache Server Time?
In other words, be patient. Don't post the question then bump it again 5 hours later.[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not receive a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.