Re: Argh Date problems

From: Date: Tue, 28 Jul 2009 20:48:05 +0000
Subject: Re: Argh Date problems
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-295981@lists.php.net to get a copy of this message
On Tue, Jul 28, 2009 at 4:02 PM, Miller, Terion<tmiller@springfi.gannett.com> wrote: > Ok so I got the > $inDate = strtotime($results[3][$i]); > > Giving me the unix date now I am trying all the different date functions that will put it in > the 0000-00-00 like sql stores it because I ran it with the unix stamp and it just stored 000000 in > the db > > Hoping something like this works? >  $formatDate = date('ymd', $inDate); > > > On 7/28/09 2:41 PM, "Miller, Terion" <tmiller@springfi.gannett.com> wrote: > > Well I was going along smoothly from this morning....but it came down to > having to change the field type to date in the mySQL..so now I have this > which returns a scraped value formatted like this 0/00/00 m/d/y > >  $inDate = $results[3][$i]; > > Which date function can I use to format for the db so that I will be able to > use range references...there are so many get_date, date_modify....I'm > lost... > > My full code is this: > > preg_match_all('/<p><font size="2" face="Arial, Helvetica, > > sans-serif">(.+)<br>(.+)<br>.+(\d+\/\d+\/\d+)\s(.+)<br>(.+)<br>.+Critical > Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU', > utf8_encode($url), $results); > > > > for ($i=0; $i < count($results[0]); $i++) > { >    $name1 = strtolower($results[1][$i]); > >    $name = > ltrim($name1); > >    $address = strtolower($results[2][$i]); > >    $inDate > = $results[3][$i]; > >    $inType = $results[4][$i]; > >    $notes = > trim($results[5][$i]); > >    $critical = trim($results[6][$i]); > > > $cviolations = $results[7][$i]; > >    $noncritical = $results[8][$i]; > >    //trying to manipulate different field data > >    $cleanViolations = > str_replace('*', '', $cviolations); >    $ucName = ucwords($name); > > $ucAddress = ucwords($address); > > >    $mysql_name = > mysql_escape_string($ucName); >    $mysql_address = > mysql_escape_string($ucAddress); >    $mysql_inDate = > mysql_escape_string($inDate); >    $mysql_inType = > mysql_escape_string($inType); >    $mysql_notes = > mysql_escape_string($notes); >    $mysql_critical = > mysql_escape_string($critical); >    $mysql_cviolations = > mysql_escape_string($cleanViolations); >    $mysql_noncritical = > mysql_escape_string($noncritical); > >        echo "$ucName <br>"; > > echo "$ucAddress <br>"; >        echo "$inDate <br>"; >        echo "$inType > <br>"; >        echo "$notes <br>"; >        echo "$critical <br>"; > > //echo "$cviolations <br>"; >        echo "$cleanViolations <br>"; > > echo "$noncritical <br><hr>"; > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Can't you just explode the string and put it back together in the YYYY/MM/DD format that you need? -- Bastien Cat, the other other white meat

« previous php.general (#295981) next »