I am executing some arbitrary SQL in which i need to convert a date/time
object into an sql formatted string. Is there a simple way to do this
in rails?
Thanks
Chris
I am executing some arbitrary SQL in which i need to convert a date/time
object into an sql formatted string. Is there a simple way to do this
in rails?
Thanks
Chris
Hello Chris,
I am executing some arbitrary SQL in which i need to convert a
date/time object into an sql formatted string. Is there a simple
way to do this in rails?
Try : my_date.to_s(:db)
– Jean-François.
Chris R. wrote:
I am executing some arbitrary SQL in which i need to convert a date/time
object into an sql formatted string. Is there a simple way to do this
in rails?Thanks
Chris
try to do this
date_you_want =
“’”+dateTimeVar[“year”]+’-’+dateTimeVar[“month”]+’-’+dateTimeVar[“day”]+"’"
and then use it in the sentence.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs