# Test Fixtures - Oracle date

**URL:** <https://www.ruby-forum.com/t/test-fixtures-oracle-date/71707>\
**Category:** Rails\
**Created:** [October 10, 2006, 11:01pm UTC](https://www.ruby-forum.com/t/test-fixtures-oracle-date/71707 "2006-10-10T23:01:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jadeler\_Amin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ab992/32.png) [@Jadeler\_Amin](https://www.ruby-forum.com/u/Jadeler_Amin)\
**Post date:** [October 10, 2006, 11:01pm UTC](https://www.ruby-forum.com/t/test-fixtures-oracle-date/71707/1 "2006-10-10T23:01:11Z")

</div>

What is the proper way of setting a test fixture for a date field in  
Oracle db? I’ve tried various  
ways like switching the year and no luck.

My test fixture is:

first:  
id: 1  
department\_id: 1  
last\_name: test1  
first\_name: first1  
birth\_date: 2004-01-26 00:00:00  
country\_of\_origin: Canada  
job\_title: Programmer  
created\_on: 2004-01-26 00:00:00  
created\_by: testuser  
updated\_on: testuser  
created\_on: 2004-01-26 00:00:00  
user\_id: testuser

I keep on getting ActiveRecord::StatementInvalid: OCIError: ORA-01841:  
(full) year must be between -4713 and +9999, and not be 0…

---

<div class="post-metadata">

**Author:** ![Jadeler\_Amin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ab992/32.png) [@Jadeler\_Amin](https://www.ruby-forum.com/u/Jadeler_Amin)\
**Post date:** [October 10, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/test-fixtures-oracle-date/71707/2 "2006-10-10T23:37:14Z")

</div>

This should work:

created\_on: \<%= Time.now.to\_s(:db) %\>

---

<div class="post-metadata">

**Author:** ![Jadeler\_Amin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ab992/32.png) [@Jadeler\_Amin](https://www.ruby-forum.com/u/Jadeler_Amin)\
**Post date:** [October 11, 2006, 12:29am UTC](https://www.ruby-forum.com/t/test-fixtures-oracle-date/71707/3 "2006-10-11T00:29:17Z")

</div>

Thanks Nicholas. The reason why it didnt work for me was because a  
typo. I have 2 created\_on fields which conflicted.
