In my Rails database, I have a timestamp that looks like this 2010-12-22 18:21:46 UTC
. I need a way to just get the date 2010-12-22
from it without re-doing the database.
Try time.to_date
to extract date component from your timestamp.
To get the String
you're looking for
your_date.strftime("%Y-%m-%d")
Not sure what you mean about modifying the database?
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