I have a simple question here. I have an instance variable with a created_at. How would I convert it to Month, day, year ~ September, 13, 1987
When I tried = @example.created_at In my view it gives me 1987-09-13
Oddly enough when I do this method in console I get Sun, 13 Sep 1987
You can change how a date is displayed by specifying a format like
@example.created_at.strftime("%B, %d, %Y")
# => "September, 20, 2013"
Check out various format options here
The display format is different in console and view as the default formats are different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With