You are here: Forums Ask a Rails expert Problems with the use of time ...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 0
Sign in to rate this post
|
Hi! I created a table like this:
When I enter it, everything seems fine… But when I return to the edit view I see the time formatted like 2000-01-01 10:23:00… When I create a validate method in the model to check on the input, I allways get 2000-01-01 10:23:00, weird because I only entered 10:23… This is the validate method in the model: Can anyone help me? I hoped time would work like date, with this column I don’t have any problems… Or is there another way for me to enter a time in the database? I want to input the format HH:MM and later on I would like to calculate the total time from several records… Thhnx! |
Authority 12
Posting Rating 76
Sign in to rate this post
|
Hi, your problem is quite the same to the post at the following URL: If you don’t use some third party plug in or time format library you would have to write/code+maintain a customize library for your customized requirements by using the ruby functions for date/time format conversions one of them is the strftime(‘time format parameters’) . That may take a high time cost if you are not an expert in RoR. So try to use some library. Thanks |
Ask a Rails expert : json gem error
Ask a Rails expert : Problem with break
Ask a Rails expert : activesupport string first method error
Ask a Rails expert : url_for broken ?
Ask a Rails expert : map.routes.rb pls help
Ask a Rails expert : how to h tag in controller
Ask a Rails expert : Problem with Restful routing and partial form
Ask a Rails expert : will_paginate, search and ajax
Ask a Rails expert : Mass Deletes in Admin Section