# Not really a Ruby question, but

**URL:** <https://www.ruby-forum.com/t/not-really-a-ruby-question-but/138904>\
**Category:** Ruby\
**Created:** [May 28, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/not-really-a-ruby-question-but/138904 "2008-05-28T21:01:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 28, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/not-really-a-ruby-question-but/138904/1 "2008-05-28T21:01:17Z")

</div>

Hello,  
I’m using a Ruby script to grab some data from an Oracle database via  
an ODBC connection. Everything works great, but I want to select a  
certain date range when I query the database. However, the date is in a  
different format, I think. The Oracle field type is “date”. How would I  
be able to format a date like 05/20/2008 so that I can compare it with  
the date field in Oracle?

Thanks,

- Jeff M.

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 29, 2008, 7:37am UTC](https://www.ruby-forum.com/t/not-really-a-ruby-question-but/138904/2 "2008-05-29T07:37:27Z")

</div>

Maybe Time.now.strftime(’%d/%m/%Y’)

by  
TheR

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 29, 2008, 9:22am UTC](https://www.ruby-forum.com/t/not-really-a-ruby-question-but/138904/3 "2008-05-29T09:22:21Z")

</div>

2008/5/28 Jeff M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hello,  
> I’m using a Ruby script to grab some data from an Oracle database via  
> an ODBC connection. Everything works great, but I want to select a  
> certain date range when I query the database. However, the date is in a  
> different format, I think. The Oracle field type is “date”. How would I  
> be able to format a date like 05/20/2008 so that I can compare it with  
> the date field in Oracle?

select …  
from …  
where your\_date \>= TO\_DATE(‘05/20/2008’, ‘MM/DD/YYYY’)  
and …

see  
[http://download.oracle.com/docs/cd/B19306\_01/server.102/b14200/functions183.htm#i1003589](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions183.htm#i1003589)

Note, a good place to look for Oracle docs is [http://tahiti.oracle.com](http://tahiti.oracle.com)

Cheers

robert
