|
Added on 06.09.09 |
| Clicks 1388 |
| Rating: 5.00 out of 5 from 2 raters |

In PHP, to have today's date you can use the built in function date() or the following function I wrote, to make sure to add the correct time zone with the day light saving.
We assume that all the functions will be saved in a file called php_functions.php
Explaining the above function is quite simple, as you can see ,it has 2 parameters,$time_zone is your time zone that will be added to the GMT time plus day light saving in summer if you have it, $format is where you put the format you want the date to appear in your page, for complete formatting details, visit the PHP manual page.
$zone=3600*$time_zone; The variable $zone will hold the result of your time zone by 3600 which are the seconds in 1 hour
$today will hold the formatted date resulting by the return of the built in PHP function gmdate
See the example below to use the function
Try the example below