# Problem converting a System Time to DateTime

**URL:** <https://www.ruby-forum.com/t/problem-converting-a-system-time-to-datetime/155953>\
**Category:** Ruby\
**Created:** [December 18, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/problem-converting-a-system-time-to-datetime/155953 "2008-12-18T13:59:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Howell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7feea3/32.png) [@Marc\_Howell](https://www.ruby-forum.com/u/Marc_Howell)\
**Post date:** [December 18, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/problem-converting-a-system-time-to-datetime/155953/1 "2008-12-18T13:59:15Z")

</div>

Hi All

I am new to Ruby and working on a project which needs to read a  
SystemTime (milliseconds from 1 Jan 1970) from an xml file and convert  
it to a DateTime.

Unfortunately I cant seem to find any method for doing so in either  
the Date or Time classes. Does such a function exist? If not, is there  
any other way to do this?

Thanks for you help  
Marc

---

<div class="post-metadata">

**Author:** ![Marc\_Howell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7feea3/32.png) [@Marc\_Howell](https://www.ruby-forum.com/u/Marc_Howell)\
**Post date:** [December 18, 2008, 2:10pm UTC](https://www.ruby-forum.com/t/problem-converting-a-system-time-to-datetime/155953/2 "2008-12-18T14:10:26Z")

</div>

On Dec 18, 2:50 pm, “Marc Howell” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks for you help  
> Marc

Of course once I have clicked send, I find the solution imediately.

Time.at wasnt working because one of my Unix Times was corrupt, of  
course it was the very first one so I never realised the rest of them  
were working since it bombed out with a Bignum error on the very first  
conversion.

Thanks anyway  
Marc
