You're right Rick. I actually just discovered that a few minutes ago.


I'll find a good date conversion routine I can copy from on Google for my
PHP script to take care of that.

Thanks for pointing that out! It was only luck that I happened to go past
year end checking it just now. I wasn't even looking for that, I was
testing something else when I discovered it. I could just as easily have
missed it until I got a lot deeper into this.

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: Wednesday, January 13, 2010 3:40 PM
To: web400@xxxxxxxxxxxx
Subject: Re: [WEB400] SQL Date Range

Shannon,

This doesn't directly address your question but I believe you have a bug in
your statement. Given the data example you have you will have issues with
your date range if it is truly in MM/DD/YYYY format. For example, if you
wanted records crossing a year end your end date is less than your start
date.

We have a lot of dates like this and had to create a user defined function
to convert them to ISO for comparison. It can be done without the UDF but
it's pretty ugly.

Rick

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Shannon ODonnell
Sent: Wednesday, January 13, 2010 10:15 AM
To: 'Web Enabling the AS400 / iSeries'
Subject: [WEB400] SQL Date Range

I want to select a group of dates based on date range in a PHP app from a
MySQL database.



Assume the table name is xmittalheader and the date field is named:
XMittalDate and is in the format in the MySQL table like this: 11/02/2009



Further assume $startDate and $endDate are being brought into the PHP via a
POST from a form.



Would this be the correct syntax?





$results = mysqli_query($db, "SELECT * FROM xmittalheader WHERE XMittalDate
BETWEEN ".$startDate." and ".$endDate);





Thanks!





Shannon O'Donnell





--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a
message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.



Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.