I am trying to generate a timestamp for rails migration that I am copying into my app from an engine as part of rake task.
The following works fine, but since rails already does the same thing, i didn't know if there is a better way to do this?
Time.now.to_s.split(" ")[0..1].join(" ").gsub!(/\D/, "")
@timestamp = Time.now.strftime("%Y%m%d%H%M%S")
Time.now.utc.strftime("%Y%m%d%H%M%S")
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