PHP Inform

PHP Information & Web Hosting
 

PHP Tutorials / Web Hosting / Server Help

Programming and web server management can be a long and difficult process but we are here to help. We have numerous tutorials to help you with short cuts and learning better ways to perform tasks via PHP functions. Our tutorial writers have years of experience in programming and systems administration.

Some of the most difficult server management tasks are to make the servers more efficient for web hosting. If you happen to be looking for web hosting we recommend this web hosting company. All of McKremie's web servers use PHP5 and they have a great support department.

Whether it's the PHP code or the way the web server is configured our articles will help you simplify and make server management easier. If you have feedback on any of the tutorials on our website drop us an email. We are also looking out for knowledgeable writers to help contribute to the success of this website.

One of the most common PHP functions is the current date and time. Below you will find information on this.

Current Time and Date Calculations:

$timestamp = time() : $timestamp : 1250074974 $local = localtime() : seconds : $local[0] : 54 minutes : $local[1] : 2 hours (24hr) : $local[2] : 12 day: $local[3] : 12 month (0-11) : $local[4] : 7 (+1 for usual format) year (+1900) : $local[5] : 109 (+1900 for usual format) day of week (0-6) : $local[6] : 3 day of year (0-364) : $local[7] : 223 timezone (+/-): $local[8] : 1 getdate($timestamp) : seconds : $local["seconds"] : 54 minutes : $local["minutes"] : 2 hours : $local["hours"] : 12 mday : $local["mday"] : 12 wday : $local["wday"] : 3 mon : $local["mon"] : 8 year : $local["year"] : 2009 yday : $local["yday"] : 223 weekday : $local["weekday"] : Wednesday month : $local["month"] : August timestamp : $local[0] : 1250074974

Alternatively, you can convert any timestamp (past,present or future) directly into a formatted string.
Use either strftime() or date () :
%a - abbreviated weekday name according to the current locale :

strftime("%D",$timestamp) : Wed

%A - full weekday name according to the current locale

strftime("%A",$timestamp) : Wednesday

%b - abbreviated month name according to the current locale

strftime("%b",$timestamp) : Aug

%B - full month name according to the current locale

strftime("%B",$timestamp) : August

%c - preferred date and time representation for the current locale

strftime("%c",$timestamp) : Wed Aug 12 12:02:54 2009

%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99).

strftime("%C",$timestamp) : 20