Postgres Timestamp Fields Displayed with Time format

I have Time fields in my PostgreSQL tables, which I force to display
as time only with this entry in config/locales/en.yml:

time:
formats:
default: “%H:%M:%S”

Problem is, that format is now applied to Timestamp fields, including
the default created_at and updated_at fields.

Why is it applying the Time (time only) format to a Timestamp (date +
time) field, and how do I rectify this problem?

Thanks for any help or ideas.

On 25 April 2011 22:37, Lee [email protected] wrote:

Why is it applying the Time (time only) format to a Timestamp (date +
time) field, and how do I rectify this problem?

Timestamp fields are stored in TimeWithZone objects, so are of type
Time and your defaults will apply. You could use strftime to format
those for which the default is not appropriate, or don’t bother with
changing the default, just use strftime always.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs