Date Formats, assigning, viewing, validating, saving, changing et al

Hi,

I know Date formats are a common topic, but I've spent most of the day googling and reading - and I cannot make things make sense.

I want to use European date format dd/mm/yy. I am happy to stick with the ISO format yyyy-mm-dd It is easy to display this in uk format using strftime(%d/%m/%Y)

Now all I need to do is simply fix the validation so that it switches the uk format to the ISO format. I was thinking of just using gsub to reverse the elements, but as I tried some examples I discovered some things that I cant explain and am hoping for some guidance.

(s.order_date is a date attribute) using the console s=OrderDate.new

s.order_date="07-08-2008" s.order_date.month=08 (seems to assume uk format)

s.order_date="07/08/2008" s.order_date.month=07 (seems to assume us format)

I dont know why the two different formats are assumed. I cannot recall setting up anything to treat the nn-nn-nnnn format as uk format.

now if in the console, I enter s. The object with the textual date form is displayed.

So I thought I could fix the problem so that the user can enter / or - by substituting these before validation. BUT

If I enter s.order_date="31/08/2007", I can still see the textual display but in the console, s.order_date returns nil because the date format is invalid. I cant find a way to directly access the raw object field before it gets turned into a Date class. I need to get at the raw attribute value.

Is this the right approach, or am I missing something simple? I dont really want to add plugins unless I understand what they are changing, but it really seems simplest to me to use strftime to display and a simple before_update method to fix the format.

Thanks for any help tonypm