# WebServices and DateTime - 3 elements of civil date are nece

**URL:** <https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954>\
**Category:** Rails\
**Created:** [May 18, 2006, 9:43pm UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954 "2006-05-18T21:43:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [May 18, 2006, 9:43pm UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954/1 "2006-05-18T21:43:00Z")

</div>

I simply trying to receive an array of objects, retrieved by  
ActiveRecord from table with datetime column and I have:

test\_list(SoapControllerApiTest):  
ArgumentError: 3 elements of civil date are necessary  
/usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash' /usr/lib/ruby/1.8/date.rb:1258:in`parse’  
…

It’s a bug or I am wrong somewhere?

---

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [May 18, 2006, 10:24pm UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954/2 "2006-05-18T22:24:22Z")

</div>

Are you using Windows? I ran into the same problem. There is a problem  
with Ruby and the Windows DateTime format. I still haven’t found a  
solution to this. Supposedly ruby 1.9 fixes this, but after replacing  
the 1.8 date files with the 1.9 ones it still doesn’t work for me.

zven wrote:

> I simply trying to receive an array of objects, retrieved by  
> ActiveRecord from table with datetime column and I have:
> 
> test\_list(SoapControllerApiTest):  
> ArgumentError: 3 elements of civil date are necessary  
> /usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash' /usr/lib/ruby/1.8/date.rb:1258:in`parse’  
> …
> 
> It’s a bug or I am wrong somewhere?

---

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [May 18, 2006, 10:39pm UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954/3 "2006-05-18T22:39:38Z")

</div>

On Thu, 2006-05-18 at 22:24 +0200, Chris G. wrote:

> Are you using Windows? I ran into the same problem. There is a problem  
> with Ruby and the Windows DateTime format. I still haven’t found a  
> solution to this. Supposedly ruby 1.9 fixes this, but after replacing  
> the 1.8 date files with the 1.9 ones it still doesn’t work for me.

Nope, I am using Debian.

---

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [May 19, 2006, 1:57am UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954/4 "2006-05-19T01:57:37Z")

</div>

Hi, what’s the relevant code that generates the below error?  
If you can post the relevant method, it would help the group  
better help you.

Thanks,

-Conrad

---

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [September 27, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/webservices-and-datetime-3-elements-of-civil-date-are-nece/60954/5 "2006-09-27T21:47:34Z")

</div>

Using Ruby 1.8.4, Windows, and MySQL I ran into the same problem using  
the example in “Agile Web D. with Rails”. (The same code worked  
fine on my coworker’s Mac.)

If you want a really, really lame workaround so that you can continue in  
your development, you can add this to the  
self.parse(str=’-4712-01-01T00:00:00Z’, comp=false, sg=ITALY) function  
in date.rb:

```
str.gsub!(" Eastern", "E")
str.gsub!(" Standard", "S")
str.gsub!(" Daylight", "D")
str.gsub!(" Time", "T")

```

… before the “elem = \_parse(str, comp)”. (Make sure you add your time  
zone in there, too.)
