note 129331 added to function.date

From: Date: Wed, 13 Mar 2024 21:15:16 +0000
Subject: note 129331 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-221245@lists.php.net to get a copy of this message
There is a fine distinction between g, G, h, and H. All of them are for the hour of the day, but in four different formats. g = 12-hour format, no leading zeros G = 24-hour format, no leading zeros h = 12-hour format, with leading zeros H = 24-hour format, with leading zeros <?php date("g:i", mktime(0,0,0,3,13,2024)) // -> 12:00 date("G:i", mktime(8,0,0,3,13,2024)) // -> 8:00 date("h:i", mktime(8,0,0,3,13,2024)) // -> 08:00 date("H:i", mktime(0,0,0,3,13,2024)) // -> 00:00 ?> Essentially, capital letter is 24-hour format, lower case is 12-hour format. 'h' has leading zeros, 'g' does not. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.131 (proxied: 2604:3d09:d89:2b00:a9d6:a7f0:a1ac:c3fa) ---- Manual Page -- https://php.net/manual/en/function.date.php Edit -- https://main.php.net/note/edit/129331 Del: integrated -- https://main.php.net/note/delete/129331/integrated Del: useless -- https://main.php.net/note/delete/129331/useless Del: bad code -- https://main.php.net/note/delete/129331/bad+code Del: spam -- https://main.php.net/note/delete/129331/spam Del: non-english -- https://main.php.net/note/delete/129331/non-english Del: in docs -- https://main.php.net/note/delete/129331/in+docs Del: other reasons-- https://main.php.net/note/delete/129331 Reject -- https://main.php.net/note/reject/129331 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221245) next »