OK, turns out I was just not thinking it through.

if you were to hand in a decimal, like 1354246278.761 to rails and your DB 
column is a timestamp type. It Just Works™

Model.create column => Time.at(timestamp.to_f).utc

Will do it for you.

Sorry for the noise.

Cheers,

Matta
Matt Allen
[email protected]
0413 777 771

On 30/11/2012, at 1:32 PM, Julio Cesar Ody <[email protected]> wrote:

> Brief check using Ruby's Time#at, it seems to parse it wrong (output
> of `+new Date` in a JS console).
> 
> Removing the milliseconds from it, parses it ok.
> 
> 
> 
> On Fri, Nov 30, 2012 at 1:28 PM, Matt Allen <[email protected]> wrote:
>> Afternoon All;
>> 
>> Has anyone stored sub-second timestamps in Postgres? and then used them in 
>> rails?  Any gotchas I should be looking out for?
>> 
>> Cheers,
>> 
>> Matta
>> Matt Allen
>> [email protected]
>> 0413 777 771
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Ruby or Rails Oceania" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/rails-oceania?hl=en.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rails-oceania?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to