Argh Date problems
am 28.07.2009 21:41:49 von tmiller
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 =3D $results[3][$i];
Which date function can I use to format for the db so that I will be able t=
o
use range references...there are so many get_date, date_modify....I'm
lost...
My full code is this:
preg_match_all('/
sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);
for ($i=3D0; $i < count($results[0]); $i++)
{
$name1 =3D strtolower($results[1][$i]);
=20
$name =3D
ltrim($name1);
$address =3D strtolower($results[2][$i]);
=20
$inDate
=3D $results[3][$i];
=20
$inType =3D $results[4][$i];
=20
$notes =3D
trim($results[5][$i]);
=20
$critical =3D trim($results[6][$i]);
=20
$cviolations =3D $results[7][$i];
=20
$noncritical =3D $results[8][$i];
//trying to manipulate different field data
=20
$cleanViolations =3D
str_replace('*', '', $cviolations);
$ucName =3D ucwords($name);
$ucAddress =3D ucwords($address);
$mysql_name =3D
mysql_escape_string($ucName);
$mysql_address =3D
mysql_escape_string($ucAddress);
$mysql_inDate =3D
mysql_escape_string($inDate);
$mysql_inType =3D
mysql_escape_string($inType);
$mysql_notes =3D
mysql_escape_string($notes);
$mysql_critical =3D
mysql_escape_string($critical);
$mysql_cviolations =3D
mysql_escape_string($cleanViolations);
$mysql_noncritical =3D
mysql_escape_string($noncritical);
=20
echo "$ucName
";
echo "$ucAddress
";
echo "$inDate
";
echo "$inType
";
echo "$notes
";
echo "$critical
";
//echo "$cviolations
";
echo "$cleanViolations
";
echo "$noncritical
";
=20
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Argh Date problems
am 28.07.2009 21:45:55 von joao
In mySql you have date_format which I thinkĀ“ll solve your problem.
""Miller, Terion"" escreveu na mensagem
news:C694BEAD.41F4%kmiller13@springfi.gannett.com...
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('/(.+)
(.+)
.+(\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
Re: Argh Date problems
am 28.07.2009 22:02:15 von tmiller
Ok so I got the
$inDate =3D strtotime($results[3][$i]);
Giving me the unix date now I am trying all the different date functions th=
at will put it in the 0000-00-00 like sql stores it because I ran it with t=
he unix stamp and it just stored 000000 in the db
Hoping something like this works?
$formatDate =3D date('ymd', $inDate);
On 7/28/09 2:41 PM, "Miller, Terion" 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 =3D $results[3][$i];
Which date function can I use to format for the db so that I will be able t=
o
use range references...there are so many get_date, date_modify....I'm
lost...
My full code is this:
preg_match_all('/
sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);
for ($i=3D0; $i < count($results[0]); $i++)
{
$name1 =3D strtolower($results[1][$i]);
$name =3D
ltrim($name1);
$address =3D strtolower($results[2][$i]);
$inDate
=3D $results[3][$i];
$inType =3D $results[4][$i];
$notes =3D
trim($results[5][$i]);
$critical =3D trim($results[6][$i]);
$cviolations =3D $results[7][$i];
$noncritical =3D $results[8][$i];
//trying to manipulate different field data
$cleanViolations =3D
str_replace('*', '', $cviolations);
$ucName =3D ucwords($name);
$ucAddress =3D ucwords($address);
$mysql_name =3D
mysql_escape_string($ucName);
$mysql_address =3D
mysql_escape_string($ucAddress);
$mysql_inDate =3D
mysql_escape_string($inDate);
$mysql_inType =3D
mysql_escape_string($inType);
$mysql_notes =3D
mysql_escape_string($notes);
$mysql_critical =3D
mysql_escape_string($critical);
$mysql_cviolations =3D
mysql_escape_string($cleanViolations);
$mysql_noncritical =3D
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
Re: Argh Date problems (RESOLVED)
am 28.07.2009 22:06:05 von tmiller
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 =3D strtotime($results[3][$i]);
Giving me the unix date now I am trying all the different date functions th=
at will put it in the 0000-00-00 like sql stores it because I ran it with t=
he unix stamp and it just stored 000000 in the db
Hoping something like this works?
$formatDate =3D date('ymd', $inDate);
On 7/28/09 2:41 PM, "Miller, Terion" 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 =3D $results[3][$i];
Which date function can I use to format for the db so that I will be able t=
o
use range references...there are so many get_date, date_modify....I'm
lost...
My full code is this:
preg_match_all('/
sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);
for ($i=3D0; $i < count($results[0]); $i++)
{
$name1 =3D strtolower($results[1][$i]);
$name =3D
ltrim($name1);
$address =3D strtolower($results[2][$i]);
$inDate
=3D $results[3][$i];
$inType =3D $results[4][$i];
$notes =3D
trim($results[5][$i]);
$critical =3D trim($results[6][$i]);
$cviolations =3D $results[7][$i];
$noncritical =3D $results[8][$i];
//trying to manipulate different field data
$cleanViolations =3D
str_replace('*', '', $cviolations);
$ucName =3D ucwords($name);
$ucAddress =3D ucwords($address);
$mysql_name =3D
mysql_escape_string($ucName);
$mysql_address =3D
mysql_escape_string($ucAddress);
$mysql_inDate =3D
mysql_escape_string($inDate);
$mysql_inType =3D
mysql_escape_string($inType);
$mysql_notes =3D
mysql_escape_string($notes);
$mysql_critical =3D
mysql_escape_string($critical);
$mysql_cviolations =3D
mysql_escape_string($cleanViolations);
$mysql_noncritical =3D
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
Re: Argh Date problems
am 28.07.2009 22:48:05 von Phpster
On Tue, Jul 28, 2009 at 4:02 PM, Miller,
Terion wrote:
> Ok so I got the
> $inDate =3D 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?
> =A0$formatDate =3D date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion" 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
>
> =A0$inDate =3D $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('/
> sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
> Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
> utf8_encode($url), $results);
>
>
>
> for ($i=3D0; $i < count($results[0]); $i++)
> {
> =A0 =A0$name1 =3D strtolower($results[1][$i]);
>
> =A0 =A0$name =3D
> ltrim($name1);
>
> =A0 =A0$address =3D strtolower($results[2][$i]);
>
> =A0 =A0$inDate
> =3D $results[3][$i];
>
> =A0 =A0$inType =3D $results[4][$i];
>
> =A0 =A0$notes =3D
> trim($results[5][$i]);
>
> =A0 =A0$critical =3D trim($results[6][$i]);
>
>
> $cviolations =3D $results[7][$i];
>
> =A0 =A0$noncritical =3D $results[8][$i];
>
> =A0 =A0//trying to manipulate different field data
>
> =A0 =A0$cleanViolations =3D
> str_replace('*', '', $cviolations);
> =A0 =A0$ucName =3D ucwords($name);
>
> $ucAddress =3D ucwords($address);
>
>
> =A0 =A0$mysql_name =3D
> mysql_escape_string($ucName);
> =A0 =A0$mysql_address =3D
> mysql_escape_string($ucAddress);
> =A0 =A0$mysql_inDate =3D
> mysql_escape_string($inDate);
> =A0 =A0$mysql_inType =3D
> mysql_escape_string($inType);
> =A0 =A0$mysql_notes =3D
> mysql_escape_string($notes);
> =A0 =A0$mysql_critical =3D
> mysql_escape_string($critical);
> =A0 =A0$mysql_cviolations =3D
> mysql_escape_string($cleanViolations);
> =A0 =A0$mysql_noncritical =3D
> mysql_escape_string($noncritical);
>
> =A0 =A0 =A0 =A0echo "$ucName
";
>
> echo "$ucAddress
";
> =A0 =A0 =A0 =A0echo "$inDate
";
> =A0 =A0 =A0 =A0echo "$inType
>
";
> =A0 =A0 =A0 =A0echo "$notes
";
> =A0 =A0 =A0 =A0echo "$critical
";
>
> //echo "$cviolations
";
> =A0 =A0 =A0 =A0echo "$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
>
>
Can't you just explode the string and put it back together in the
YYYY/MM/DD format that you need?
--=20
Bastien
Cat, the other other white meat
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Argh Date problems
am 28.07.2009 22:51:55 von tmiller
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 =3D 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 =3D date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion" 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 =3D $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('/
> sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
> Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
> utf8_encode($url), $results);
>
>
>
> for ($i=3D0; $i < count($results[0]); $i++)
> {
> $name1 =3D strtolower($results[1][$i]);
>
> $name =3D
> ltrim($name1);
>
> $address =3D strtolower($results[2][$i]);
>
> $inDate
> =3D $results[3][$i];
>
> $inType =3D $results[4][$i];
>
> $notes =3D
> trim($results[5][$i]);
>
> $critical =3D 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
YYYY/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 u=
se 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/yyyy order and that part is gi=
ving me problems...
Not getting why since I figured I could do this again:
$date =3D $row['inDate']; $formatDate =3D 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: Argh Date problems (RESOLVED)
am 29.07.2009 15:59:21 von tmiller
I had a tiny syntax error keeping it from working in the form of a cap lett=
er.
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 =3D 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 =3D date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion" 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 =3D $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('/
> sans-serif">(.+)
(.+)
.+(\d+\/\d+\/\d+)\s(.+)
(.+)
.+Critical
> Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
> utf8_encode($url), $results);
>
>
>
> for ($i=3D0; $i < count($results[0]); $i++)
> {
> $name1 =3D strtolower($results[1][$i]);
>
> $name =3D
> ltrim($name1);
>
> $address =3D strtolower($results[2][$i]);
>
> $inDate
> =3D $results[3][$i];
>
> $inType =3D $results[4][$i];
>
> $notes =3D
> trim($results[5][$i]);
>
> $critical =3D 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
YYYY/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 u=
se 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/yyyy order and that part is gi=
ving me problems...
Not getting why since I figured I could do this again:
$date =3D $row['inDate']; $formatDate =3D 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