[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: How to convert long/milliseconds to DateTime?

Gavin Kistner

10/24/2006 7:18:00 PM

From: Mike Nospam
> Java developer making the switch.

Welcome!


> I have timestamps stored in Oracle as
> a long (gotten from java.sql.Timestamp - milliseconds from
> some day in
> 1970). Is there a way to convert that long back into a Ruby
> Date/DateTime/Time . Any of these would do.

ri Time.at

2 Answers

Mike Nospam

10/24/2006 7:43:00 PM

0

Thanks Gavin. I did a lot of Smalltalk programming in the 90's, so Ruby
has a familiar, fun feel.

I tried this already:

t = Time.at(1161275493444)
puts t

Resulting in:
Exception: bignum too big to convert into `long'

No joy. Am I missing something (else)?

Thanks,

Mike

Gavin Kistner wrote:
> From: Mike Nospam
>> Java developer making the switch.
>
> Welcome!
>
>
>> I have timestamps stored in Oracle as
>> a long (gotten from java.sql.Timestamp - milliseconds from
>> some day in
>> 1970). Is there a way to convert that long back into a Ruby
>> Date/DateTime/Time . Any of these would do.
>
> ri Time.at


--
Posted via http://www.ruby-....

khaines

10/24/2006 7:57:00 PM

0