gmdate($date_format,$timestamp);
| Parameter | DESCRIPTION |
|---|---|
| $date_format | Required : Format required for output. Details are below. |
| $timestamp | Optional: Unix timestamp |
Functionality of gmdate() is same as date() function
| Format | date() | gmdate() |
|---|---|---|
| 'd/m/y H:i:s' | 21/11/25 04:47:59 | 21/11/25 04:47:59 |
| 'F j, Y, g:i a' | November 21, 2025, 4:47 am | November 21, 2025, 4:47 am |
date_default_timezone_set ("Asia/Kolkata");
$date1=gmdate("M d Y H:i:s") ; // current date and time
echo $date1;
echo "<br>";
$date2=gmdate("M d Y H:i:s",mktime(23, 58, 59, 12, 25, 2023)) ;
echo $date2;Output is here ( refresh the page to check the changes )Nov 21 2025 04:47:59
Dec 25 2023 18:28:59 Formats | Type | Ch | DESCRIPTION |
|---|---|---|
| Date | d | day of the month, 2 digits with leading zeros; i.e. '01' to '31' |
| j | day of the month without leading zeros; i.e. '1' to '31' | |
| Day | D | day of the week, textual, 3 letters; i.e. 'Fri' |
| l | day of the week, textual, long; i.e. 'Saturday' | |
| w | day of the week, numeric, i.e. '0' (Sunday) to '6' (Saturday) | |
| z | day of the year; i.e. '0' to '365' | |
| r | RFC 822 formatted date; i.e. 'Thu, 21 Dec 2000 16:01:07 +0200' (added in PHP 4.0.4) | |
| S | Suffix for day of the month in 2 chrs ( with j ) | |
| z | Day of the year ( from 0 to 365 ) | |
| Month | m | month; With leading zeros; i.e. '01' to '12' |
| n | month without leading zeros; i.e. '1' to '12' | |
| M | month, textual, 3 letters; i.e. 'Jan' | |
| F | month, textual, long; i.e. 'January' | |
| t | Number of days in the month ( 28 to 31 ) | |
| Year | L | 1 for Leap year, 0 if not |
| o | ISO-8601 week-numbering year. | |
| Y | year, 4 digits; i.e. '2018' | |
| y | year, 2 digits; i.e. '19' | |
| Time | ||
| Hour | g | hour, 12-hour format without leading zeros; i.e. '1' to '12' |
| G | hour, 24-hour format without leading zeros; i.e. '0' to '23' | |
| h | hour, 12-hour format; i.e. '01' to '12' | |
| H | hour, 24-hour format; i.e. '00' to '23' | |
| Minutes | i | minutes; i.e. '00' to '59' |
| Seconds | s | seconds; i.e. '00' to '59' |
| a | 'am' or 'pm' | |
| A | 'AM' or 'PM' | |
| B | Swatch Internet time | |
| I | '1' if Daylight Savings Time, '0' otherwise. | |
| L | boolean for whether it is a leap year; i.e. '0' or '1' | |
| T | Timezone setting of this machine; i.e. 'MDT' | |
| U | seconds since the epoch | |
| Z | timezone offset in seconds (i.e. '-43200' to '43200'). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. | |
| e, O, P and T | timezone identifier ( e ) , difference in Hour and minutes to GMT (O),+- Hour : Minute (P), Short name of zone ( IST) (T) | |
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.