Skip to Content
avatar image
Former Member

Converting String to Date Type

Hi,

I would like to have a simple query :

select ...

from ...

where lastmoddate between to_date('20080101','YYYYMMDD') AND to_date('20090101','YYYYMMDD')

The function to_date is not exist on MaxDB, Is there any similar function on MaxDB ?

If this kind of function is not exist on MaxDB, How else I can range between ddates ?

Many Thanks,

Ido

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 26, 2008 at 03:56 PM

    Hi Ido

    Please try following:

    select * from ... where lastmoddate between {d '2008-11-26'} and {d '2008-11-27'}

    FYI, there exists besides {d '...'} for date, {t '...'} for time and {ts '...'} for timestamp.

    Example:

    create table datetest2 (id int, d date)
    insert into datetest2 values (1, now())
    insert into datetest2 values (2, now())
    
    select * from datetest2 where d between {d '2008-11-26'} and {d '2008-11-27'} 
    

    Regards Thomas

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 26, 2008 at 03:57 PM

    Hi,

    did you try just to say

    lastmoddate between '20080101' and '20090101'

    ?

    I think, that should do.

    Perhaps '20081231' would be better for the upper limit as it is inclusive.

    Elke

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 27, 2008 at 08:13 AM

    Thansk Thomas,

    Its working.

    Your answer was very helpfull.

    Best Regards,

    Ido

    Add comment
    10|10000 characters needed characters exceeded