[rt-users] RT 2.0.3 and Dates

Feargal Reilly feargal at thecia.ie
Wed Jul 25 18:37:56 EDT 2001


On Wed, 25 Jul 2001 14:40:12 -0700
"Rob" <falcon at rasterburn.com> wrote:

> With $self->SimpleQuery("SET DATESTYLE TO 'ISO'"); set, it still stores the
> timestamps in the DB as the default date style.  So it looks like something
> else needs to be done.

No, that's fine - it doesn't matter what datestyle you're using when the value is being stored.
I trashed this out with Jesse a while ago, and he set me straight. He seems to be quiet today, so I'll catch you up.

When you set the datestyle, you're essentially saying 'Gimme dates in the following format so I know how to parse them' - it doesn't affect the internals.

To see what I mean, look at the following sequence of commands:

feargal at ithil-es: psql rt2
rt2=>show datestyle;
NOTICE: DateStyle is SQL with European conventions

rt2=>select created from transactions where id=1;
 30/12/1999 16:38:14.00 GMT

rt2=>set datestyle to iso;
rt2=>select created from transactions where id=1;
 1999-12-30 16:38:14+00

rt2=>\! psql rt2

rt2=>show datestyle;
NOTICE: DateStyle is SQL with European conventions
rt2=>\q
rt2=>\q
feargal at ithil-es:

The datestyle only changes the format in which the data is handed to you.

Notice I started a second session, from within the first, and the datestyle was back to the default for my postgres.

> As a work around, I just added some code in Date.pm to parse the 'sql' date
> style.

That's what I'd done too, Jesse corrected me - the idea with Searchbuilder is that it'll provide a consistent way to deal with the different DBIs - mysql, postgres and Oracle.
ISO is consistent across them all, so by setting the datestyle, RT knows what format the timestamps will be in.

I guess that the two of us are the only postgres users with non-ISO datestyles as default, so it never came up before.

-- 
Feargal Reilly,
Systems Administrator,
The CIA.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20010725/94074ae1/attachment.sig>


More information about the rt-users mailing list