Click here to get back home

Manipulating date with "00" in it coming from mySQL

 HomeNewsGroups | Search

comp.lang.php - PHP programming language discussions 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Manipulating date with "00" in it coming from mySQL JackM 05-13-2009
Posted by The Natural Philosopher on May 14, 2009, 4:26 am
Please log in for more thread options
=C1lvaro G. Vicario wrote:
show/hide quoted text
=20
show/hide quoted text

show/hide quoted text
=20
show/hide quoted text
=20
show/hide quoted text
Indeed.One might argue that Mysql is likely to be faster (being=20
compiled) than php at sorting data out..as well as ultimately being able =

to survive a possible internal format change on upgrade, better..

Posted by Jerry Stuckle on May 14, 2009, 6:34 am
Please log in for more thread options
Álvaro G. Vicario wrote:
show/hide quoted text

In this case I think it is, because this would call several additional
functions. Additionally, it doesn't do what he needs - it doesn't
return the year and month when only the day is 00. That could be done,
but it's even more work.

I think that a simple explode() and test would be much better here.
It's also easier to understand.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Posted by Jerry Stuckle on May 13, 2009, 2:48 pm
Please log in for more thread options
JackM wrote:
show/hide quoted text

You should have gotten an E_NOTICE about $arrayData[1] not existing.
This is because the separator in your explode should be '-', not " ".

Additionally, your tests are incorrect - $arrayData[1] cannot be both
'00' and '', so your echo statement will never execute.

Also, you already have the year in $arrayData[1], why not just echo it
instead of calling the date function?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Posted by JackM on May 13, 2009, 3:58 pm
Please log in for more thread options
Jerry Stuckle wrote:
show/hide quoted text

Jerry, as I mentioned above, I'm using
$title1 = date('Y F d', strtotime($row["dt"]));
to get the data. That has already removed the "-" separator that is in
the db field. So my delimiter is in fact a space. Confirmed by echoing
the variable. Ergo, no error. The $title1 variable has the year, month
and day as in 1970 May 05 already in it. So I was counting 1970 as
$arrayData[0], May as $arrayData[1] and 05 as $arrayData[2]. I want to
check only 1 and 2 for the double 00 and only print the year (if both
month/day are 00) or the year and month (if day is 00) from the
$arrayData if it is found. That's my goal.

I will try what you suggest: echo the $arrayData[1].


Similar ThreadsPosted
Help with comparing date stamp in PHP to date AND time stamp coming from MYSQL db!!!!!! May 8, 2008, 1:21 am
displaying a pdf coming out of a mysql-db in a frame October 8, 2004, 12:31 pm
Date is not being pulled from MYSQL database, instead current date is displayed!!! March 22, 2006, 12:29 pm
Put today's date into a MySQL "date" formated field August 3, 2006, 3:47 pm
manipulating forms December 12, 2006, 9:07 pm
Manipulating binary data April 29, 2007, 12:36 pm
manipulating multiple browser windows September 9, 2004, 4:44 pm
reading and manipulating vcalendar files June 12, 2005, 8:00 am
Manipulating an object returned from function July 13, 2007, 12:11 pm
POST variables not coming through August 29, 2006, 11:33 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy