What determines the date/time format for SELECT statements in Rails?

S

Stuart Smith

If I issue a select statement on a table containing
date/time/datetime/timestamp columns (type depends on backend DB)can I
guarantee that the returned formatted output from the corresponding
ActiceRecord column will always be the same regardless of the backend
DB.

The format appears to be 'YYYY-MM-DD HH:MM:SS'; what sets up the
format and can I change it?

Thanks
 
D

David Heinemeier Hansson

If I issue a select statement on a table containing
date/time/datetime/timestamp columns (type depends on backend DB)can I
guarantee that the returned formatted output from the corresponding
ActiceRecord column will always be the same regardless of the backend
DB.

Active Record doesn't support timestamp columns, but all the others are
turned into Date or Time objects regardless of the database behind.
That's part of the job of the adapters. Exposing a common front for
Active Record to operate on the database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top