Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Informix - how to decrease 30 minutes from current time

1,012 views
Skip to first unread message

liat.b...@gmail.com

unread,
Apr 22, 2008, 4:21:50 AM4/22/08
to
hello,

I'm trying to decrease 30 minutes from datetime recieved vy paramter,
but I need to correct syntax because none of the following working:
select (2008-04-14 10:00) - 30 units minute or
select "2008-04-14 10:00" - 30 units minute or
select (2008-04-14 10:00) year to minute - 30 units minute

I used to use dateadd function for sybase (select
dateadd(mi,-30,'01/02/2008 10:30'))
and I need help how to run it in informix.

richard...@googlemail.com

unread,
Apr 22, 2008, 4:29:06 AM4/22/08
to
On 22 Apr, 09:21, liat.bars...@gmail.com wrote:
> hello,
>
> I'm trying to decrease 30 minutes from datetime recieved vy paramter,
> but I need to correct syntax because none of the following working:
> select (2008-04-14 10:00) - 30 units minute or
> select "2008-04-14 10:00" - 30 units minute or
> select (2008-04-14 10:00) year to minute - 30 units minute

Almost, try:

select datetime(2008-04-14 10:00) year to minute - 30 units minute

ii...@perrior.net

unread,
Apr 22, 2008, 4:49:35 AM4/22/08
to
On 22 Apr, 09:29, richard.harn...@googlemail.com wrote:
> On 22 Apr, 09:21, liat.bars...@gmail.com wrote:
>
> > hello,
>
> > I'm trying to decrease 30 minutes from datetime recieved vy paramter,
> > but I need to correct syntax because none of the following working:
> > select (2008-04-14 10:00) - 30 units minute or
> > select "2008-04-14 10:00" - 30 units minute or
> > select (2008-04-14 10:00) year to minute - 30 units minute
>
> Almost, try:
>
> select datetime(2008-04-14 10:00) year to minute - 30 units minute
>
There's always the arcane "EXTEND" syntax but why bother when you can
CAST the input value (also, give the resultant expression a name such
as "time_diff"'):

SELECT "2008-04-14 10:00"::DATETIME YEAR TO MINUTE - 30 UNITS MINUTE
time_diff

... and remember to add a FROM clause (because you have to SELECT from
somewhere, even if it's a dummy):
FROM systables WHERE tabid=99
will always work (tabid 99 is the engine version entry)

liat.b...@gmail.com

unread,
Apr 22, 2008, 6:13:35 AM4/22/08
to


THANKS A LOT both are working !!!!!

0 new messages