note 123388 added to class.dateperiod

From: Date: Thu, 29 Nov 2018 20:19:06 +0000
Subject: note 123388 added to class.dateperiod
Groups: php.notes 
Request: Send a blank email to php-notes+get-209812@lists.php.net to get a copy of this message
An extra piece of information on how to use the (modify method) to easily get date ranges: <?php $subscription_start_date = new DateTime( 'now' ); // Modify the $subscription_start_date date value to required date range, // this could be in days or months depending on how your application is designed // Days $subscription_expiration = $subscription_start_date->modify( '+60 days' ); echo $subscription_expiration->format( 'Y-m-d' ) . "\n"; // Months $subscription_expiration = $subscription_start_date->modify( '+2 Months' ); echo $subscription_expiration->format( 'Y-m-d' ) . "\n"; // Or even in years $subscription_expiration = $subscription_start_date->modify( '+2 years' ); echo $subscription_expiration->format( 'Y-m-d' ) . "\n"; ?> ---- Server IP: 208.43.231.9 Probable Submitter: 197.211.63.71 ---- Manual Page -- http://php.net/manual/en/class.dateperiod.php Edit -- https://master.php.net/note/edit/123388 Del: integrated -- https://master.php.net/note/delete/123388/integrated Del: useless -- https://master.php.net/note/delete/123388/useless Del: bad code -- https://master.php.net/note/delete/123388/bad+code Del: spam -- https://master.php.net/note/delete/123388/spam Del: non-english -- https://master.php.net/note/delete/123388/non-english Del: in docs -- https://master.php.net/note/delete/123388/in+docs Del: other reasons-- https://master.php.net/note/delete/123388 Reject -- https://master.php.net/note/reject/123388 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209812) next »