Posted By

stancox on 06/09/11


Tagged

time date


Versions (?)

ruby time to javascript


 / Published in: Ruby
 

URL: http://blog.hulihanapplications.com/browse/view/58-ruby-time-to-javascript

  1. class Time
  2. def to_js # to javascript, ie: "2007-06-09T14:23:11", usage: new Date("<%= Time.now.to_js %>")
  3. self.strftime("%Y-%m-%dT%H:%M:%S")
  4. end
  5. end

Report this snippet  

You need to login to post a comment.