RE: [PHP] function.date.php

From: Date: Wed, 25 Feb 2004 21:06:24 +0000
Subject: RE: [PHP] function.date.php
Groups: php.general 
Request: Send a blank email to php-general+get-178888@lists.php.net to get a copy of this message
Actually, your use of substr is incorrect. The third parameter is how many characters you want to go from your offset, not the ending character. Also, your last variable shouldn't be year...it should be day (or whatever you want to name it...anything but year or month :) ), otherwise you will overwrite your previously set year with the day of the month :) Aside from that, you can use the date function once you fix your code a bit: $mynewdate = date("F d, Y", mktime(0, 0, 0, $month, $day, $year) ; HTH! --Sam John Taylor-Johnston wrote: > Is there a way to reverse engineer > http://www.php.net/manual/en/function.date.php ? > > I want to feed in 2003-02-28 and extract February 28, 2003. I can > substr it out ... > > $eventid = "2003-02-28"; > > $year = substr($eventid, 0,4); > $month = substr($eventid, 5,7); > $year = substr($eventid, 8,10); > > But there must be a function that would do it? Everything else exists > :)

« previous php.general (#178888) next »