tags:

views:

9

answers:

0

Hi all,

We're slowly porting some code away from MySQL specifically to MDB2. Generally, it's going pretty well. Where we are really hitting snags, though, is with the date/time/interval 'mathematics'.

For example, if I wanted to grab "an hour from now" from MySQL, I use: SELECT (NOW() + INTERVAL 1 HOUR);

To do it in Postgres, I need to quote "1 HOUR": SELECT (NOW() + INTERVAL '1 HOUR');

We went towards this as at first, at least, because we realised that Postgres doesn't have DATEADD type functions (apparently).

So has anyone else come across this? How do you do date/time mathematics / conversions in MDB2? Preferably this would also give me some pointers on how to 'extend' this out to deal with FROM_UNIXTIME and UNIXTIMESTAMP type functions too...

Thoughts, hints, tips or tricks?

I'm OK with changing our queries somewhat, but at the moment, at least, it seems important to keep the data itself stored in actual date/time data types, while being able to convert them back and forth to and from Unix timestamps.

Thanks...