note 68937 added to function.date

From: Date: Wed, 16 Aug 2006 16:57:05 +0000
Subject: note 68937 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-115978@lists.php.net to get a copy of this message
Hey. Just for the ones of you that want a date format equal to N but only have earlier versions of PHP (less than 5.1) installed on the server. Here's a method of converting the w date argument and get the day of the weekday in N format. <?php function get_weekday( $stamp ) { $a = date( "w", $stamp ) - 1; if ( $a == -1 ) $a = 6; return ++$a; } ?> Should return the same value as it's 5.1 version big brother below. <?php $weekday = date( "N", $stamp ); ?> Now you'll get a range from 1-7 according to which day you're feeding the function by Epoch secs. Good luck! ---- Server IP: 83.137.200.2 Probable Submitter: 84.202.79.204 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/68937 Del: integrated -- https://master.php.net/note/delete/68937/integrated Del: useless -- https://master.php.net/note/delete/68937/useless Del: bad code -- https://master.php.net/note/delete/68937/bad+code Del: spam -- https://master.php.net/note/delete/68937/spam Del: non-english -- https://master.php.net/note/delete/68937/non-english Del: in docs -- https://master.php.net/note/delete/68937/in+docs Del: other reasons-- https://master.php.net/note/delete/68937 Reject -- https://master.php.net/note/reject/68937 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115978) next »