Discussion:
PowerLauncher
(too old to reply)
unknown
2008-10-27 21:03:11 UTC
Permalink
What is the correct format to input a date range to search
the database between dates? I've tried the greaterthan,
lessthan with a comma between, a space between, on the next
line. It's very frustrating. Can you help?
Terry Dykstra [TeamSybase]
2008-11-05 19:07:41 UTC
Permalink
I always use international date format (yyyy/mm/dd) to enter dates. If you
don't like that, then basically you have to enter dates using the short date
format (typically mm/dd/yy for US users, dd/mm/yy for Canadian, European
users) as set on the user's PC.
Be aware that if you have datetime columns in your database, then Chris'
example would fail to find 2008/10/31 records if there is a time portion on
the record. You would have to use 2008/11/01 or a database function to
eliminate the time portion (e.g. trunc() in oracle).
--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://casexpress.sybase.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement
Hi Carole;
If it is a pure "date" only column then it would be >= 2008-10-01 and
<=2008-10-31.
Have a look at the attached example I did for you.
HTH
--
Regards ... Chris
ISUG - NA RUG Director
http://chrispollach.pbdjmagazine.com
Post by unknown
What is the correct format to input a date range to search
the database between dates? I've tried the greaterthan,
lessthan with a comma between, a space between, on the next
line. It's very frustrating. Can you help?
Chris Pollach
2008-11-05 19:15:31 UTC
Permalink
Note1: The format yyyy-mm-dd is impervious to the regional date settings
and is the ANSI standard format.

Note2: You are correct about my example if its a DateTime - however, just
= 2008-10-01 00:00:00 and <= 2008-10-31 23:59:59
:-)
I always use international date format (yyyy/mm/dd) to enter dates. If you
don't like that, then basically you have to enter dates using the short
date format (typically mm/dd/yy for US users, dd/mm/yy for Canadian,
European users) as set on the user's PC.
Be aware that if you have datetime columns in your database, then Chris'
example would fail to find 2008/10/31 records if there is a time portion
on the record. You would have to use 2008/11/01 or a database function to
eliminate the time portion (e.g. trunc() in oracle).
--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://casexpress.sybase.com
http://my.isug.com/cgi-bin/1/c/submit_enhancement
Hi Carole;
If it is a pure "date" only column then it would be >= 2008-10-01 and
<=2008-10-31.
Have a look at the attached example I did for you.
HTH
--
Regards ... Chris
ISUG - NA RUG Director
http://chrispollach.pbdjmagazine.com
Post by unknown
What is the correct format to input a date range to search
the database between dates? I've tried the greaterthan,
lessthan with a comma between, a space between, on the next
line. It's very frustrating. Can you help?
Loading...