# Review: Time does not map to System.DateTime

**URL:** <https://www.ruby-forum.com/t/review-time-does-not-map-to-system-datetime/179220>\
**Category:** IronRuby\
**Created:** [November 19, 2009, 10:26pm UTC](https://www.ruby-forum.com/t/review-time-does-not-map-to-system-datetime/179220 "2009-11-19T22:26:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [November 19, 2009, 10:26pm UTC](https://www.ruby-forum.com/t/review-time-does-not-map-to-system-datetime/179220/1 "2009-11-19T22:26:27Z")

</div>

tfpt review /shelveset:time;sborde

Makes Time mutable. It was mapped to System.DateTime which is immutable.  
However, Time#utc mutates the instance. So now we define a new type Time  
with a \_dateTime field. The core\shared\gmtime test is not enabled  
because it expects that modifying ENV[‘TZ’] at runtime changes the  
timezone, which is not supported yet in IronRuby (and MRI too)

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [January 12, 2010, 4:34am UTC](https://www.ruby-forum.com/t/review-time-does-not-map-to-system-datetime/179220/2 "2010-01-12T04:34:08Z")

</div>

I’ve just upgraded to the latest IronRuby and am hitting this… Given  
that  
I have a bunch of Time objects, how do I now convert them to a  
System::DateTime for clr interop? I can’t seem to find any methods on  
the  
ruby Time object that return the clr object

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [January 12, 2010, 5:44am UTC](https://www.ruby-forum.com/t/review-time-does-not-map-to-system-datetime/179220/3 "2010-01-12T05:44:21Z")

</div>

RubyTime class is implicitly convertible to DateTime. So you shouldn’t  
need to convert it explicitly in most cases.  
You can call DateTime method to get DateTime from RubyTime if needed:

> > > Time.now  
> > > =\> Mon Jan 11 20:40:12 -0800 2010  
> > > Time.now.DateTime  
> > > =\> 1/11/2010 8:40:15 PM

Tomas

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Orion E.  
Sent: Monday, January 11, 2010 7:27 PM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] Review: Time does not map to  
System.DateTime

I’ve just upgraded to the latest IronRuby and am hitting this… Given  
that I have a bunch of Time objects, how do I now convert them to a  
System::DateTime for clr interop? I can’t seem to find any methods on  
the ruby Time object that return the clr object
