For a lot of people, when they use the date()
function in PHP, it doesn't display the correct time and date for their region,
as their servers may be in a different part of the world to where they are. This
simple bit of code uses the gmdate() function to overcome this little
General description of gmdate() function is as follows:
|General Format||string gmdate(string $format [, int $timestamp] )|
|Parameters||$format: the format of the date string||$timestamp: Integer Unix timestamp|
|Return Value||Returns the formatted date string|
ECHO "<b>Date using date()fucntion is:</b>"."<br/>"; echo date("M d Y H:i:s",mktime(0,0,0,1,1,1998))."<br/>"; ECHO "<b>Date using gmdate()fucntion is:</b>"."<br/>"; echo gmdate("M d Y H:i:s",mktime(0,0,0,1,1,1998))."<br/>";
Date using date()fucntion is: Jan 01 1998 00:00:00 Date using gmdate()fucntion is: Jan 01 1998 00:00:00
Note: To know the date format in details please visit our web page: http://www.roseindia.net/tutorial/php/phpdate/index.html
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.