Re: month

From: Date: Tue, 01 Apr 2003 11:31:39 +0000
Subject: Re: month
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-141804@lists.php.net to get a copy of this message
On Tuesday 01 April 2003 17:49, Justin French wrote: > on 01/04/03 9:16 PM, Diana Castillo (diana@interhotel.com) wrote: > > how do you get just the month (in numeric format ) of a specific date. > > (not today) > > same for day and year. The date is in yyyy-dd-mm format to start with. > > thanks. > > If your date was yyyy-mm-dd, you could do this: > > <? > $date = '2002-03-18'; > echo date('m', strtotime($date)); > ?> > > But, because yours isn't: > > <? > $date = '2002-03-18'; > list($y,$d,$m) = explode('-',$date); > echo date('m', strtotime("{$y}-{$m}-{$d}")); > ?> I don't want to be awkward, but wouldn't $m be holding the required info already? -- ignoring the fact that you have an invalid date. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* What would you expect to gain from XIP besides being buzzword compliant? - Erik Mouw on linux-arm-kernel */

« previous php.general (#141804) next »