R – i need to update the current time in a sql query


Usage of Time.now or Time.now.to_s or Time.now.to_datetime is throwing error.

Usage of Date.today doesn't help as it stores the date with time as 12.00 AM and not the current time stamp.

Please help me in resolving this issue.

Best Solution

I'm not sure why and what is throwing an error, but if you're trying to generate a date string that is correct SQL from Ruby (specifically Rails here) you can use Time.now.to_s(:db).