Re: Argh Date problems (RESOLVED)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" <tmiller@xxxxxxxxxxxxxxxxxxxx> wrote:




On 7/28/09 3:48 PM, "Bastien Koert" <phpster@xxxxxxxxx> wrote:

On Tue, Jul 28, 2009 at 4:02 PM, Miller,
Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx> 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]);
>
>
> 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


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux