On September 19, 2006 5:15 PM, Charles Yeomans wrote:
>
> On Sep 19, 2006, at 2:27 AM, Dr Gerard Hammond wrote:
>
> >> Is it really the case that DatabaseField.DateValue
> >> returns nil for a date in SQL format?
> >
> >
> > If you are using the REALSQL database as you sure that the date
> > went into the system in the ISO8601 format?
> > I think you must put dates into the system this way to
> > ensure that they come out correctly.
> >
> > Dates are a pain in every computer, on every continent......
>
> I've found the problem, and it's on my end; dates were
> entered into a database in another format.

You must be careful when using dates with REALSQL DB.

See report id: ytjmuobi
http://tinyurl.com/b362t
"When inserting dates on a Date column (YYYY-MM-DD) by using the RB
DatabaseRecord's DateColumn method, these dates fails the following
date comparisons: GREATER THAN, EQUAL and DIFFERENT THAN."

The way I use dates with REALSQL DB (and sometimes with MS SQL) is to
store the date in two (or three columns if using time).
- The first column I store the usual date in SQL format: YYYY-MM-DD
HH:MM:SS
- On the second column I store in a integer column just the date:
YYYYMMDD
- If the date has a time and I will use it for data comparisons I
store it on a third integer column: HHMMSS

I never get any problems when retrieving records based on date
comparisons, because I use the integer columns for the comparisons. I
also create indexes just for the Integer columns in order to optimize
the selects when I use dates in the "WHERE" and "ORDER BY" clauses.

Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to