[MonetDB-users] converting strings to dates?

Niels Nes Niels.Nes at cwi.nl
Tue Dec 4 16:23:26 CET 2007


On Tue, Dec 04, 2007 at 09:24:07AM +0100, Fabian Groffen wrote:
> On 03-12-2007 16:29:35 -0700, m h wrote:
> > In Oracle I can do the following:
> > 
> > select *
> > from table
> > where timestampcol BETWEEN to_date('01/01/07', 'MM/DD/RR') AND
> > to_date('12/31'/07'), 'MM/DD/RR')

select * from table
where timestampcol between timestamp '2007/01/01' and timestamp '2007/12/31'

should do the trick.

Niels
> > 
> > It's not clear that this is possible in monetdb.
> > 
> > There's the EXTRACT function which pulls a numeric value (month, day
> > or year) from a string representing a timestamp, but I can't see how
> > to get a timestamp/date object out?
> 
> Given you do a BETWEEN it looks like you want numeric values, so
> something like EXTRACT epoch FROM sometimestamp.  I believe we could
> also compare timestamps so maybe BETWEEN just works here.
> 
> You can "cast" strings to a time/date/timestamp by using SQL99 notation
>   timestamp '2007-12-04 09:22:02'
> 
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell.  From the desktop to the data center, Linux is going
> mainstream.  Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________
> MonetDB-users mailing list
> MonetDB-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-users

-- 

Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02,  phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels   e-mail: Niels.Nes at cwi.nl




More information about the users-list mailing list