How to strip time zone part from Time leaving date and time parts intact? Currently I am using strftime function. My end goal is to query MySQL with local time for sure. I should be sure that local time won't be suddenly converted to something else.
Ruby | DateTime parse() function DateTime#parse() : parse() is a DateTime class method which parses the given representation of date and time, and creates a DateTime object. Return: given representation of date and time, and creates a DateTime object.
The now() is an inbuilt method in Ruby returns the current time.
You can use time.strftime('%Y-%m-%d %H:%M:%S')
as used by activesupport in eg
Time.now.to_s(:db)
source
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