Ask a Question related to PHP Development, Design and Development.
-
rob #1
Array of Dates from MYSQL?...
This has been puzzelling me for a couple of weeks now, and just can't figure
it out.
Does anyone know how to return an array of dates from MySQL given the start
date and end date. The database has a rows containing 'start date' and 'end
date' I need an array containing all the days between 'start date' and 'end
date', ie:
Start Date = 15/06/2004
End Date = 17/06/2004
Array returned: 15/06/2004,16/06/2004,17/06/2004
Hope this make sense?... I would love to hear if anyone has done this before
or has any idea's how I can do this.
MySQL 4.0 and PHP 4
Thanks in advance.
rob Guest
-
How to you compare dates in a query in Mysql
Dear friends, Plesae help in finding the correct syntax for comparing two dates in a query in MySql database Thank you Subodh Gupta -
MySQL Dates
Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats... -
Searching on Dates in MySQL
Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats... -
Convert CF list of dates to javascript array
I have a list of dates <cfset myDatesList= "2005-05-29 19:50:16.0,2005-05-30 19:51:30.0,2005-05-31 19:52:24.0,2005-06-01 19:55:55.0,2005-06-02... -
Web form dates to MySQL
I am building a admin form (PHP/MySQL), so staff can input Job Vacancy descriptions into the Website via a Web form that can be displayed on the... -
eclipsboi #2
Re: Array of Dates from MYSQL?...
I've done this before, and what I had to do is store the dates (both
start, and end) as UNIX time (number of seconds/miliseconds from Jan
1, 1970), and then convert my dates to UNIX time also. Then, you can
do a greater than (>) and less than (<) comparison on your respective
fields, like so:
SELECT * FROM my_table
WHERE
start_date >= '$start_date'
AND
end_date <= '$end_date';
And formatting the UNIX time is very simple, you can use either date()
or strftime() to get a more appealing time string.
This of course is just my personal opinion, and of course there are
other ways of doing this. I just find UNIX time to be a bit more
flexible because I can rearrange the date format, to my fickle heart's
content.
On Mon, 28 Jun 2004 16:20:37 +0000 (UTC), "rob" <rob@one01.co.uk>
wrote:
>This has been puzzelling me for a couple of weeks now, and just can't figure
>it out.
>
>Does anyone know how to return an array of dates from MySQL given the start
>date and end date. The database has a rows containing 'start date' and 'end
>date' I need an array containing all the days between 'start date' and 'end
>date', ie:
>
>Start Date = 15/06/2004
>End Date = 17/06/2004
>
>Array returned: 15/06/2004,16/06/2004,17/06/2004
>
>Hope this make sense?... I would love to hear if anyone has done this before
>or has any idea's how I can do this.
>
>MySQL 4.0 and PHP 4
>
>Thanks in advance.
>eclipsboi Guest



Reply With Quote

