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

  • Home
  • SEARCH
  • 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 6036435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:55:27+00:00 2026-05-23T05:55:27+00:00

Is there a way to represent a time in ruby without having a Date

  • 0

Is there a way to represent a time in ruby without having a Date attached? I am doing a timetracking application and I only need in/out times, there is a separate column for date.

The MySQL TIME data type stores only the time, but in Rails it comes back as Jan 1 2000 + what ever time is there.

Should i just ignore the date part, or is there a way to eliminate it?

  • 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-23T05:55:27+00:00Added an answer on May 23, 2026 at 5:55 am

    There’s no way to eliminate it, because:

    Time is stored internally as the number of seconds with fraction since the Epoch, January 1, 1970 00:00 UTC.

    Just format it like this:

    t = Time.now
    t.strftime("at %I:%M%p")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way one can represent a time only value in .NET without
Is there a simple or elegant way to grab only the time of day
Is there a way to represent a time value in Excel where hours can
Is there an efficient way to search a message for substrings which might represent
Is there an accepted way to represent high resolution timestamps in JSON and/or JavaScript?
I'm having an impossible time creating a DateTime object that stores the date 02/29/101
What's the best way to represent a time period in Java? May I use
For some reason I'm having a heck of a time figuring out how to
I'm having the hardest time figuring out something that seems like it should be
Is there a way to join tables on one field that represents a series

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.