Databases store dates in YYYY-MM-DD format so that operations like
sorting by date work properly.
But why do you care. ActiveRecord will convert to and from ruby Time
or DateTime objects and you can format them for display as you wish,
no matter how they are stored in the DB.
Lets try and make this easier for the OP to read...
You don't need to worry how the date is stored in the tables. You are
not going to access the tables directly (unless you need another
external app interacting with the same database). You are going to
access them trough Models.
When a model has a method that relates to a date column, it is going
to return a Date object.
When a model has a method that relates to a datetime column, it is
going to return a Time object.
So, lets say you have an Order model (that relates to the Orders
table) and this Order model has a shipped_at attribute (relates to the
shipped_at datetime column in your database). You can store the data
on this attribute by using "@order.shipped_at = Time.now". If you need
to read this datetime to show to the user in a view, you can use
"@order.shipped_at.to_formatted_s(:short)". This will generate
For more help generating different Time objects, use:
Several examples are shown in AWDWR and on this group.