Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 768905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:15:12+00:00 2026-05-14T18:15:12+00:00

I have a simple Rails 3.b1 (Ruby 1.9.1) application running on Sqlite3. I have

  • 0

I have a simple Rails 3.b1 (Ruby 1.9.1) application running on Sqlite3. I have this table:

create_table :time_tests do |t|
  t.time :time
end

And I see this behavior:

irb(main):001:0> tt = TimeTest.new
=> #<TimeTest id: nil, time: nil>
irb(main):002:0> tt.time = Time.zone.now
=> Mon, 03 May 2010 20:13:21 UTC +00:00
irb(main):003:0> tt.save
=> true
irb(main):004:0> TimeTest.find(:first)
=> #<TimeTest id: 1, time: "2000-01-01 20:13:21">

So, the time is coming back blank. Checking the table, the data looks OK:

sqlite> select * from time_tests;
1|2010-05-03 20:13:21.774741

I guess it’s on the retrieval part? What’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:15:13+00:00Added an answer on May 14, 2026 at 6:15 pm

    Technically, it’s not coming back blank. It comes back as a time with a default date. It returns 2000-01-01 20:13:21 as the time, which is expected.

    Rails is doing some magic loading of the data into a Time object and clearing out the date (since you only told it to store the time).

    If you want to store the date and time then you need to define the column as a datetime. And conversely, if you wanted just a date you would use date.

    So to recap:

    date => "2010-12-12 00:00:00"
    time => "2000-01-01 13:14:15"
    datetime => "2010-12-12 13:14:15"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have an extensive ruby application running behind Ruby on Rails right now.
I have site running rails application and resque workers running in production mode, on
I have developed a simple library in Ruby and need to use this in
I have a Ruby on Rails application that has two active environments, Stage and
I am just playing around with Ruby on Rails 3.0 with a simple message
I'm hoping this is a simple one. I run a Rails web app where
I have an existing Rails 2.3.10 app that I'm considering upgrading to Ruby 1.9.2
I have a simple application to calculate a quote for a picture framing job.
Rails: 3.0.3 Ruby: 1.9.2 Trying to deserialize a very simple object using YAML.load or
Writing my first, very simple Rails application, a simple admin app to track work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.