date formats in select statements

[prev] [thread] [next] [Date index for 2004/11/23]

From: Isarin.Sathitruangsak
Subject: date formats in select statements
Date: 16:01 on 23 Nov 2004
Hi,

could someone please help me shed some light on how to convert date format
in CDBI, not using set_sql?
I am not really sure how to use Class::Date or DateTime with  CDBI.   Sorry
I don't follow what the docs say about it.
I would need date format in either ' yyyymmdd; or 'hh:mm:ss' or both in my
select statements.
Up until now, I ended up using set_sql.


__PACKAGE__->set_sql( date_range => qq(
        SELECT feed_id, trans_id,
        CASE WHEN start_time is null
             THEN convert(char(8), end_time, 112)
             ELSE convert(char(8), start_time, 112)
        END as ccyymmdd,
      convert(char(8), start_time, 108) as start_hour,
      convert(char(8), end_time, 108) as end_hour
        FROM __TABLE__
        WHERE feed_id = ?
        and ((start_time between ? and dateadd(dd, 1, ?))
        or (end_time between ? and  dateadd(dd, 1, ?)))
        order by ccyymmdd
        ));

Thank you,
IS




date formats in select statements
Isarin.Sathitruangsak 16:01 on 23 Nov 2004

Re: date formats in select statements
Peter Speltz 16:13 on 23 Nov 2004

Re: date formats in select statements
Peter Speltz 16:54 on 23 Nov 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52