I have a column called test_date
, type datetime
in General Exam table. I built a form to create and update GeneralExam, on form, I allow User choose a date and time throught jQuery UI Datepicker
.
After user choose date and time, it will displayed in textfield, like:
25-11-2012 16:30
It is my current time. When I run in console, I see the test_date
was saved in database is:
2012-11-25 09:30:00
And when I get object GeneralExam, and get test_date
value, it is:
g = GeneralExam.last
g.test_date
=> Sun, 25 Nov 2012 16:30:00 ICT +07:00
I think test_date
is converted, because I set up in application.rb
is:
config.time_zone = 'Hanoi'
But when I update a General Exam on form, it still display the time was saved in database, not my local timezone, it means it display:
2012-11-25 09:30:00
But I want it is like what I chose on form:
25-11-2012 16:30:00
How can I set up for display datetime column in local time?
And I think the order of date was reversed, when I choose date, it is 25-11-2012
, but when it displayed it was 2012-11-25
, Why it reversed the order?