Re: [PHP] Argh Date problems (RESOLVED)

2009-07-29 Thread Miller, Terion
I had a tiny syntax error keeping it from working in the form of a cap letter.



On 7/28/09 3:51 PM, "Miller, Terion"  wrote:




On 7/28/09 3:48 PM, "Bastien Koert"  wrote:

On Tue, Jul 28, 2009 at 4:02 PM, Miller,
Terion 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 -00-00 like sql stores it because I ran it with the 
> unix stamp and it just stored 00 in the db
>
> Hoping something like this works?
>  $formatDate = date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion"  wrote:
>
> Well I was going along smoothly from this morningbut 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_modifyI'm
> lost...
>
> My full code is this:
>
> preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+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]);
>
>
> echo "$noncritical ";
>
>
>
> --
> 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
/MM/DD format that you need?

--

Bastien

Cat, the other other white meat


Well I got it all formatted and going in the db right and now I'm able to use 
the BETWEEN in my sql and it works like a charm but when I echo the date for 
the page I need to put it back in mm/dd/ order and that part is giving me 
problems...
Not getting why since I figured I could do this again:

$date = $row['inDate'];$formatDate = date('mdy', $Date);

But at any rate it's nearly beer o'clock here hooray, and I'm feeling like 
today I have earned one or two!!
Until tomorrow
Terion


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Argh Date problems (RESOLVED)

2009-07-28 Thread Miller, Terion
OMG AND I FIGURED IT OUT MYSELF...dang I just may be learning some php..


On 7/28/09 3:02 PM, "Miller, Terion"  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 -00-00 like sql stores it because I ran it with the unix 
stamp and it just stored 00 in the db

Hoping something like this works?
 $formatDate = date('ymd', $inDate);


On 7/28/09 2:41 PM, "Miller, Terion"  wrote:

Well I was going along smoothly from this morningbut 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_modifyI'm
lost...

My full code is this:

preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+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 ";

echo "$ucAddress ";
echo "$inDate ";
echo "$inType
";
echo "$notes ";
echo "$critical ";

//echo "$cviolations ";
echo "$cleanViolations ";

echo "$noncritical ";



--
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