开发者

How can I get Rails to interpret a text field as a datetime

开发者 https://www.devze.com 2022-12-27 19:51 出处:网络
My database has a datetime field, and I want to be able to create new entries. Obviously the Rails datetime_select helper isn\'t the most user frien开发者_运维百科dly thing to have in your form.

My database has a datetime field, and I want to be able to create new entries. Obviously the Rails datetime_select helper isn't the most user frien开发者_运维百科dly thing to have in your form.

I'd rather have a text field for the datetime (or one for the date, and one for the time) and interpret the inputs like PHP strtotime can.

I might just be searching the wrong keywords. Surely this has been discussed in great depth somewhere.

Thanks

:0)


Check out Railscast #32, I've used this method a few times and it works pretty well.

0

精彩评论

暂无评论...
验证码 换一张
取 消