experiences in software development
Date.parse(Time.now.strftime('%Y/%m/%d'))
ActiveSupport implements Time#to_date. If you're not working on a Rails application, you could always borrow their implementation.
Perfect. Thanks.
No kidding!Date, Time, and File objects in ruby could learn something from the Java core API. Oh well.
Using strftime isn't necessary. You just do:Date.parse(Time.now.to_s)(replace Time.now with your date object!)
Note: Only a member of this blog may post a comment.
ActiveSupport implements Time#to_date. If you're not working on a Rails application, you could always borrow their implementation.
ReplyDeletePerfect. Thanks.
ReplyDeleteNo kidding!
ReplyDeleteDate, Time, and File objects in ruby could learn something from the Java core API. Oh well.
Using strftime isn't necessary. You just do:
ReplyDeleteDate.parse(Time.now.to_s)
(replace Time.now with your date object!)