ruby time to javascript

/ Published in: Ruby
Save to your folder(s)

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


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.