Tag Archives: date and time

Page Rendering Time

A lot of websites show the page rendering time at the bottom. How can we implement this in our Rails website? We discuss a simple approach, where you wrap between two calls to Time.now (to get the current time). Subtracting them yields the time difference, in fractional seconds. Continue reading

Posted in Development | Tagged , , | 1 Comment

Date and Time Fields in Object Forms

How can you create a date or datetime field in Rails, quickly and easily, for your form objects? Rails has two helpers–date_select, and datetime_select. Both take a model instance name and a field name; they generate multiple fields required for precise selection of date and time values. Continue reading

Posted in Development | Tagged , | Comments Off

Created_On and Updated_On

Rails allows two special fields, created_on and updated_on, that it updates automatically. It tracks when model objects are created and updated. All you need to do is create the fields; Rails populates the values. Since these fields are useful, you can format them, to display them any way you please! Continue reading

Posted in Development | Tagged , , , | Comments Off