Thanks for the quick reply Tim,
I dont think people entering m/d/y instead of d/m/y will be a problem
as Its what I think to be the common form in the UK (although I
realise americans often use m/d/y).

I was referring to my model when using the admin page to add a date so
that it only accepts date in the dd/mm/yy format.  And again only
displays that date format to the user.
DuncanM

On Mar 2, 2:18 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > In my models I use DateField quite a few times, is there any
> > way I can adjust it so it stores information in the database
> > as dd/mm/yy and retrieves/handles it in this way too rather
> > then its current yyyy-mm- dd format?
>
> I'm not sure this question makes a whole lot of sense without
> some clarification...dates should be handled transparently as
> date objects all over the place.  They have year/month/day
> properties that can be accessed, and timedelta objects can be
> added or subtracted from them.  They have no inherent "format"
> other than a tuple of values (or as a *nix timestamp or what have
> you).
>
> The only time the format of a date should come into question is
> on actually presenting it to the user (and when reading it from
> the user).  For presenting the date, there's the "date" filter
> which allows you to format the date in all sorts of ways:
>
>         {{ mydatefield|date:"d-m-Y" }}
>
> Reading back the date, one reason for the YYYY-MM-DD format is
> that it's internationally unambiguous.  If you get a date in the
> format 1-2-2006, should that be interpreted as Feb 1st or as Jan
> 2nd?  It depends on where you are.  Clearly if one of the first
> two fields is > 12, you have a definite answer.  But when both
> are 1<=N<=12  you have an ambiguity that's better to ensure that
> the person entering data means what the program interprets.  If
> you must allow your data-entry folks to use d/m/y you may be able
> to employ the time.strptime() function to extract what you want.
>  Just be prepared to get folks entering m/d/y instead of d/m/y
>
> -tkc


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to