<div>This might help some people, but I always use the locale files here:  <a href="https://github.com/svenfuchs/rails-i18n">https://github.com/svenfuchs/rails-i18n</a><div><br></div><div>Once you've got your locale set up right, everything else seems to just drop into place.</div></div>
                <div><br>Neil<br></div>
                 
                <p style="color: #a0a0a0;">On Tuesday, 26 July 2011 at 15:53, Jordi Noguera Leon wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div>You can specify the formats for your dates in config/initializers/time.rb with:<div><br></div><div><div>Date::DATE_FORMATS[:default] = "%d/%m/%y"</div><div>Date::DATE_FORMATS[:whatever] = "%y-%m-%d"</div>
<div><br></div><div>(Date::DATE_FORMATS or Time::DATE_FORMATS depending on whether you're dealing with Date objects or Time objects)</div><div><br></div><div>Then, @date.to_s should do what you're expecting and you could do @date.to_s(:whatever)</div>
<div><br><br><div>On 26 July 2011 15:34, John Winters <span dir="ltr"><<a href="mailto:john@sinodun.org.uk">john@sinodun.org.uk</a>></span> wrote:<br><blockquote type="cite"><div>
<div>On 26/07/11 14:48, Paul Robinson wrote:<br><blockquote type="cite"><div>
On 26 Jul 2011, at 14:20, John Winters wrote:<br>
<br><blockquote type="cite"><div>
You make reference to "helpers" - can you provide any pointers to<br>
those? I keep find myself going round and round in the documentation<br>
in the area of Date/Time/DateTime, with one bit referring to another<br>
bit, which refers you to a third bit and then back to the start, with<br>
none of them providing the hard information.<br>
</div></blockquote><br>
<br>
Oh Lord, this is actually a bit of a mess for complex cases, but if your<br>
use case is simple, it's dead easy.<br>
<br>
You might want to get familiar with i18n:<br>
<br>
<a href="http://guides.rubyonrails.org/i18n.html" target="_blank">http://guides.rubyonrails.org/<u></u>i18n.html</a><br>
</div></blockquote><br></div>
[snip]<br>
<br>
I've taken a look at that, but I *think* it's heading off in a different direction from what I'm trying to achieve, and from searching other queries found on the web it appears it doesn't even achieve what I want.<br>

<br>
That covers how to get different date formats to appear for different users, *in the body of your pages*.  What it doesn't appear to do is cover how to get different date formats to appear by default in your fields.  I've set up a skeletal test and whilst I can get:<br>

<br>
my_date.to_s<br>
<br>
to produce different strings depending on the format which I set up, a text field still staunchly displays:<br>
<br>
2011-07-26<br>
<br>
regardless of any formats specified.<br>
<br>
I'm currently digging through the Rails source (which is hard on the eyes) trying to find out exactly what conversion the field helpers are using, and whether it can be changed by configuration options.<br>
<br>
Eventually I expect I'll get bored and just use the sledgehammer approach which I started with, but I really hate that kind of messy solution.<div><div><br>
<br>
Cheers,<br>
John<br>
______________________________<u></u>_________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/<u></u>listinfo.cgi/chat-lrug.org</a><br>
</div></div></div></blockquote></div><br></div></div>
</div><div>_______________________________________________<br>Chat mailing list<br><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>