Question about Dates in DB

I’m working on some reports for our RT database, and I’m noticing that
fields get populated with 1/1/1970 if there is nothing entered into the
DB.

Is this accurate assessment? If so can I just assume that 1/1/1970 =
null?

Thanks in advance.

Justin Brodley

At Tuesday 6/19/2007 11:26 AM, Justin Brodley wrote:

I’m working on some reports for our RT database, and I’m noticing
that fields get populated with 1/1/1970 if there is nothing entered
into the DB.

Is this accurate assessment? If so can I just assume that 1/1/1970 = null?

Yes, that’s right. One other twist, if I recall correctly, (it may
depend on what database you use- we run Oracle) is that sometimes
null dates are stored as null in the database. So you may have to
allow for both null and 1/1/1970 as meaning “no date set”.

Steve

It’s nice to see that its consistently inconsistent. We are also running
Oracle, so I’ll have to look out for this.

Justin BrodleyFrom: Stephen Turner [mailto:sturner@MIT.EDU]
Sent: Tuesday, June 19, 2007 8:31 AM
To: Justin Brodley; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Question about Dates in DB

At Tuesday 6/19/2007 11:26 AM, Justin Brodley wrote:

I’m working on some reports for our RT database, and I’m noticing
that fields get populated with 1/1/1970 if there is nothing entered
into the DB.

Is this accurate assessment? If so can I just assume that 1/1/1970 =
null?

Yes, that’s right. One other twist, if I recall correctly, (it may
depend on what database you use- we run Oracle) is that sometimes
null dates are stored as null in the database. So you may have to
allow for both null and 1/1/1970 as meaning “no date set”.

Steve

FWIW, a brief snoop didn’t turn up any null date fields in our MySQL RT
database.

Gene

At 08:31 AM 6/19/2007, Stephen Turner wrote:

At Tuesday 6/19/2007 11:26 AM, Justin Brodley wrote:

I’m working on some reports for our RT database, and I’m noticing that
fields get populated with 1/1/1970 if there is nothing entered into the DB.

Is this accurate assessment? If so can I just assume that 1/1/1970 = null?

Yes, that’s right. One other twist, if I recall correctly, (it may depend
on what database you use- we run Oracle) is that sometimes null dates are
stored as null in the database. So you may have to allow for both null and
1/1/1970 as meaning “no date set”.

Steve


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media. Buy a
copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Yes, 1/1/1970 is equal to ‘Not set’, but I think you have to expect
this to be changed to real NULL as I have very strong wish to change
it as NULLs are clearer, easier for development and more flexible.
Hope we’ll have time to do it before 3.8.0On 6/19/07, Stephen Turner sturner@mit.edu wrote:

At Tuesday 6/19/2007 11:26 AM, Justin Brodley wrote:

I’m working on some reports for our RT database, and I’m noticing
that fields get populated with 1/1/1970 if there is nothing entered
into the DB.

Is this accurate assessment? If so can I just assume that 1/1/1970 = null?

Yes, that’s right. One other twist, if I recall correctly, (it may
depend on what database you use- we run Oracle) is that sometimes
null dates are stored as null in the database. So you may have to
allow for both null and 1/1/1970 as meaning “no date set”.

Steve


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

That would be great especially when dealing with reporting applications, having a value there makes them more complex, as I have to set “not equals” statements.

Justin Brodley From: ruslan.zakirov@gmail.com [mailto:ruslan.zakirov@gmail.com] On Behalf Of Ruslan Zakirov
Sent: Tuesday, June 19, 2007 12:09 PM
To: Stephen Turner
Cc: Justin Brodley; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Question about Dates in DB

Yes, 1/1/1970 is equal to ‘Not set’, but I think you have to expect
this to be changed to real NULL as I have very strong wish to change
it as NULLs are clearer, easier for development and more flexible.
Hope we’ll have time to do it before 3.8.0