Opened 5 years ago

Closed 5 years ago

#13925 closed (invalid)

models.py DateTime field formatting

Reported by: mikewells Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi there!

I was just wondering the best way to go about using a model's DateTime field with a specific formatting. eg. (mm/dd/yyyy hh:mm:ss) and nothing else in a postgres database.

The reason for this is because I want to pull data out of the database in that exact format and pass it to a dygraph object that accepts it in that format.

At the moment when I'm adding data using the admin interface its formatting it as (yyyy-mm-dd hh:mm:ss), which wouldn't be that much of a problem to just parse when read out of the database but I am just trying to eliminate this step. Also when looking at the actual data stored in the database (postgres) it is being stored with some offset of +9 hours and some sort of metadata (+2)? eg (2010-07-12 22:49:59+02). I don't wan't any of this... just the date stored as (mm/dd/yyyy hh:mm:ss). How can I accomplish this?

Many thanks
Mike

Change History (1)

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Please post "How do I?" questions to django-users mailing list or #django IRC channel. Trac is for reporting bugs and feature requests, and this does not sound like either of those.

Note: See TracTickets for help on using tickets.
Back to Top