gmdate(): GMT/UTC date and time

gmdate($date_format,$timestamp);
ParameterDESCRIPTION
$date_formatRequired : Format required for output. Details are below.
$timestampOptional: Unix timestamp
Output is the Greenwich Mean Time - GMT date and time string displaying as per the input format.

Functionality of gmdate() is same as date() function

Difference in output between date() and gmdate()

Formatdate()gmdate()
'd/m/y H:i:s'05/03/24 01:53:0605/03/24 01:53:06
'F j, Y, g:i a'March 5, 2024, 1:53 amMarch 5, 2024, 1:53 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 )
Mar 05 2024 01:53:06
Dec 25 2023 18:28:59
Formats
TypeChDESCRIPTION
Datedday of the month, 2 digits with leading zeros; i.e. '01' to '31'
jday of the month without leading zeros; i.e. '1' to '31'
DayDday of the week, textual, 3 letters; i.e. 'Fri'
lday of the week, textual, long; i.e. 'Saturday'
wday of the week, numeric, i.e. '0' (Sunday) to '6' (Saturday)
zday of the year; i.e. '0' to '365'
rRFC 822 formatted date; i.e. 'Thu, 21 Dec 2000 16:01:07 +0200' (added in PHP 4.0.4)
SSuffix for day of the month in 2 chrs ( with j )
zDay of the year ( from 0 to 365 )
Monthmmonth; With leading zeros; i.e. '01' to '12'
nmonth without leading zeros; i.e. '1' to '12'
Mmonth, textual, 3 letters; i.e. 'Jan'
Fmonth, textual, long; i.e. 'January'
tNumber of days in the month ( 28 to 31 )
YearL1 for Leap year, 0 if not
oISO-8601 week-numbering year.
Yyear, 4 digits; i.e. '2018'
yyear, 2 digits; i.e. '19'
Time
Hourghour, 12-hour format without leading zeros; i.e. '1' to '12'
Ghour, 24-hour format without leading zeros; i.e. '0' to '23'
hhour, 12-hour format; i.e. '01' to '12'
Hhour, 24-hour format; i.e. '00' to '23'
Minutesiminutes; i.e. '00' to '59'
Secondssseconds; i.e. '00' to '59'
a'am' or 'pm'
A'AM' or 'PM'
BSwatch Internet time
I'1' if Daylight Savings Time, '0' otherwise.
Lboolean for whether it is a leap year; i.e. '0' or '1'
TTimezone setting of this machine; i.e. 'MDT'
Useconds since the epoch
Ztimezone 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 Ttimezone identifier ( e ) , difference in Hour and minutes to GMT (O),+- Hour : Minute (P), Short name of zone ( IST) (T)
PHP Date Functions Date Difference Unix timestamp for a GMT date
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer