Thursday, April 19, 2012

Re: [Rails] Parse date for given locale

On 20 April 2012 03:51, Ahmy Yulrizka <ahmy135@gmail.com> wrote:
> Hi, I've search this term on google and didn't get the result that im
> looking for.
>
> given a date and a locale, some times the date in '%d/%m'%Y' but sometimes
> it '%m/%d/%Y' according to the locale.

I think the best solution is not to allow free format of date but to
provide separate fields for each part. datetime_select can do this
for you automatically.

If you really need to do it however, then provided you know what the
format is then use strptime to parse it.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment