note 118581 added to function.strftime

From: Date: Fri, 01 Jan 2016 07:15:09 +0000
Subject: note 118581 added to function.strftime
Groups: php.notes 
Request: Send a blank email to php-notes+get-204582@lists.php.net to get a copy of this message
For all those who work with WampServer on Windows, I propose you a formatting(layout) of date as " Friday, January 1st, 2016 " instead of " Friday, January 01st, 2016 " (note the zero in front of 1) which works at the same time on Windows / WampServer and on (on-line) Linux / waiter. There are problems with "%e" - > which(who) works on Linux and not on Windows - > "%#d" (this works on windows/wampserver) I simply made a condition: <?php if ($_SERVER['SERVER_NAME'] == "website.com") // On line { $number_of_the_day= "%e"; // Number of the day without "0" } else { $number_of_the_day = "%#d"; // The same on Windows/Wampserver } setlocale(LC_TIME, 'fr_FR.utf8','fra'); // I'm french ! // i use this fonction ucfirst('string') for "V" Maj. and "J" Maj. echo ucfirst(strftime('%A '.$number_of_the_day.' %B %Y')); // "Vendredi 1 Janvier 2016" (-> without "0") ?> Here we are, I hope to have helped. ---- Server IP: 72.52.91.14 Probable Submitter: 80.119.210.251 ---- Manual Page -- http://php.net/manual/en/function.strftime.php Edit -- https://master.php.net/note/edit/118581 Del: integrated -- https://master.php.net/note/delete/118581/integrated Del: useless -- https://master.php.net/note/delete/118581/useless Del: bad code -- https://master.php.net/note/delete/118581/bad+code Del: spam -- https://master.php.net/note/delete/118581/spam Del: non-english -- https://master.php.net/note/delete/118581/non-english Del: in docs -- https://master.php.net/note/delete/118581/in+docs Del: other reasons-- https://master.php.net/note/delete/118581 Reject -- https://master.php.net/note/reject/118581 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204582) next »